Built with Alectryon, running Coq+SerAPI v8.11.0+0.11.1. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use instead of Ctrl.
(* Distributed under the terms of the MIT license. *)
From MetaCoq.Template Require Import config utils Ast AstUtils Induction LiftSubst
     UnivSubst Reduction WfInv Typing.
From Equations Require Import Equations.
Require Import ssreflect ssrbool.

Well-formedness of terms and types in typing derivations

The internal representation of terms is not canonical, so we show that only well-formed terms and types can appear in typing derivations and the global context.
Definition wf_decl d :=
  match decl_body d with
  | Some b => Ast.wf b
  | None => True
  end /\ Ast.wf (decl_type d).

Definition wf_decl_pred : context -> term -> option term -> Type :=
  (fun _ t T => Ast.wf t /\ match T with
                        | Some T => Ast.wf T
                        | None => True
                        end).


forall Γ : context, Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

forall Γ : context, Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
Γ:context
X:Forall wf_decl Γ

All_local_env wf_decl_pred Γ
X:Forall wf_decl []

All_local_env wf_decl_pred []
a:context_decl
Γ:list context_decl
X:Forall wf_decl (a :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred (a :: Γ)
X:Forall wf_decl []

All_local_env wf_decl_pred []
constructor; eauto.
a:context_decl
Γ:list context_decl
X:Forall wf_decl (a :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred (a :: Γ)
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
All_local_env wf_decl_pred ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred Γ
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ ty None
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ body (Some ty)
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred Γ
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

Forall wf_decl Γ
inv X; eauto.
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

wf_decl_pred Γ ty None
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

Ast.wf ty /\ True
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty /\ True
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ
True
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty
apply H.
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ

True
constructor.
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

wf_decl_pred Γ body (Some ty)
na:aname
body, ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := Some body; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

Ast.wf body /\ Ast.wf ty
na:aname
body, ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := Some body; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf body /\ Ast.wf ty
eauto.
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred Γ
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
wf_decl_pred Γ ty None
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

All_local_env wf_decl_pred Γ
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

Forall wf_decl Γ
inv X; eauto.
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

wf_decl_pred Γ ty None
na:aname
ty:term
Γ:list context_decl
X:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: Γ)
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ

Ast.wf ty /\ True
na:aname
ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty /\ True
na:aname
ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty
na:aname
ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl Γ
True
na:aname
ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl Γ

Ast.wf ty
apply H.
na:aname
ty:term
Γ:list context_decl
IHΓ:Forall wf_decl Γ -> All_local_env wf_decl_pred Γ
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl Γ

True
constructor. Qed.
H:checker_flags
Σ:global_env
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type

(forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T) -> on_global_env P Σ -> on_global_env Q Σ
H:checker_flags
Σ:global_env
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type

(forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T) -> on_global_env P Σ -> on_global_env Q Σ
H:checker_flags
Σ:global_env
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
X0:on_global_env P Σ

on_global_env Q Σ
H:checker_flags
Σ:global_env
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
X0:on_global_env P Σ

on_global_env Q Σ
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
d:global_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl d:universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn d
IHX0:on_global_env Q Σ

on_global_decl Q (Σ, TemplateLookup.universes_decl_of_decl d) kn d
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
d:global_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl d:universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn d

on_global_decl Q (Σ, TemplateLookup.universes_decl_of_decl d) kn d
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
c:constant_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl (ConstantDecl c):universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn (ConstantDecl c)

on_constant_decl Q (Σ, cst_universes c) c
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl (InductiveDecl m):universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn (InductiveDecl m)
on_inductive Q (Σ, ind_universes m) kn m
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
c:constant_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl (ConstantDecl c):universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn (ConstantDecl c)

on_constant_decl Q (Σ, cst_universes c) c
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_body0:option term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl (ConstantDecl {| cst_type := cst_type0; cst_body := cst_body0; cst_universes := cst_universes0 |}):universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn (ConstantDecl {| cst_type := cst_type0; cst_body := cst_body0; cst_universes := cst_universes0 |})

on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := cst_body0; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t0 : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ:global_env
kn:kername
cst_type0, t:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:on_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |}

on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:on_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t0 : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ:global_env
kn:kername
cst_type0, t:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:LevelSet.For_all (fun l : LevelSet.elt => ~ LevelSet.In l (TemplateLookup.global_levels Σ)) (levels_of_udecl udecl) /\ ConstraintSet.For_all (fun '(l1, _, l2) => LevelSet.In l1 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ)) /\ LevelSet.In l2 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ))) (constraints_of_udecl udecl) /\ match udecl with | Monomorphic_ctx ctx => LevelSet.for_all (fun x : Level.t => ~~ Level.is_var x) ctx.1 | Polymorphic_ctx _ => True end /\ satisfiable_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |}

match cst_body {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |} with | Some trm => Q (Σ, cst_universes0) [] trm (Some (cst_type {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |})) | None => on_type Q (Σ, cst_universes0) [] (cst_type {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |}) end
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:on_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t0 : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t0 T -> Q Σ0 Γ t0 T
Σ:global_env
kn:kername
cst_type0, t:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:LevelSet.For_all (fun l : LevelSet.elt => ~ LevelSet.In l (TemplateLookup.global_levels Σ)) (levels_of_udecl udecl) /\ ConstraintSet.For_all (fun '(l1, _, l2) => LevelSet.In l1 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ)) /\ LevelSet.In l2 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ))) (constraints_of_udecl udecl) /\ match udecl with | Monomorphic_ctx ctx => LevelSet.for_all (fun x : Level.t => ~~ Level.is_var x) ctx.1 | Polymorphic_ctx _ => True end /\ satisfiable_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := Some t; cst_universes := cst_universes0 |}

Q (Σ, cst_universes0) [] t (Some cst_type0)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:on_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:on_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}

on_constant_decl Q (Σ, cst_universes0) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:LevelSet.For_all (fun l : LevelSet.elt => ~ LevelSet.In l (TemplateLookup.global_levels Σ)) (levels_of_udecl udecl) /\ ConstraintSet.For_all (fun '(l1, _, l2) => LevelSet.In l1 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ)) /\ LevelSet.In l2 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ))) (constraints_of_udecl udecl) /\ match udecl with | Monomorphic_ctx ctx => LevelSet.for_all (fun x : Level.t => ~~ Level.is_var x) ctx.1 | Polymorphic_ctx _ => True end /\ satisfiable_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}

match cst_body {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |} with | Some trm => Q (Σ, cst_universes0) [] trm (Some (cst_type {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |})) | None => on_type Q (Σ, cst_universes0) [] (cst_type {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}) end
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
cst_type0:term
cst_universes0:universes_decl
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=cst_universes0:universes_decl
o:LevelSet.For_all (fun l : LevelSet.elt => ~ LevelSet.In l (TemplateLookup.global_levels Σ)) (levels_of_udecl udecl) /\ ConstraintSet.For_all (fun '(l1, _, l2) => LevelSet.In l1 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ)) /\ LevelSet.In l2 (LevelSet.union (levels_of_udecl udecl) (TemplateLookup.global_levels Σ))) (constraints_of_udecl udecl) /\ match udecl with | Monomorphic_ctx ctx => LevelSet.for_all (fun x : Level.t => ~~ Level.is_var x) ctx.1 | Polymorphic_ctx _ => True end /\ satisfiable_udecl Σ udecl
o0:on_constant_decl P (Σ, udecl) {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}

on_type Q (Σ, cst_universes0) [] cst_type0
now eapply X.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=TemplateLookup.universes_decl_of_decl (InductiveDecl m):universes_decl
o:on_udecl Σ udecl
o0:on_global_decl P (Σ, udecl) kn (InductiveDecl m)

on_inductive Q (Σ, ind_universes m) kn m
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
o0:on_inductive P (Σ, udecl) kn m

on_inductive Q (Σ, ind_universes m) kn m
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

on_inductive Q (Σ, ind_universes m) kn m
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

Alli (on_ind_body Q (Σ, ind_universes m) kn m) 0 (ind_bodies m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
on_context Q (Σ, ind_universes m) (ind_params m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

Alli (on_ind_body Q (Σ, ind_universes m) kn m) 0 (ind_bodies m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

Alli ?P 0 (ind_bodies m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
forall (n : nat) (x : one_inductive_body), ?P n x -> on_ind_body Q (Σ, ind_universes m) kn m n x
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

forall (n : nat) (x : one_inductive_body), on_ind_body P (Σ, udecl) kn m n x -> on_ind_body Q (Σ, ind_universes m) kn m n x
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

forall (n : nat) (x : one_inductive_body), on_ind_body P (Σ, udecl) kn m n x -> on_ind_body Q (Σ, ind_universes m) kn m n x
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

on_ind_body Q (Σ, ind_universes m) kn m n x
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

on_type Q (Σ, ind_universes m) [] (ind_type x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
on_constructors Q (Σ, ind_universes m) m n x (ind_indices x) (ind_ctors x) (ind_cunivs X1)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
check_ind_sorts Q (Σ, ind_universes m) (ind_params m) (ind_kelim x) (ind_indices x) (ind_cunivs X1) (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, ind_universes m) m v (ind_indices x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

on_type Q (Σ, ind_universes m) [] (ind_type x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_type P (Σ, udecl) [] (ind_type x)

on_type Q (Σ, ind_universes m) [] (ind_type x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:P (Σ, udecl) [] (ind_type x) None

Q (Σ, ind_universes m) [] (ind_type x) None
now eapply X.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

on_constructors Q (Σ, ind_universes m) m n x (ind_indices x) (ind_ctors x) (ind_cunivs X1)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) (ind_cunivs X1)

on_constructors Q (Σ, ind_universes m) m n x (ind_indices x) (ind_ctors x) (ind_cunivs X1)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)

on_constructors Q (Σ, ind_universes m) m n x (ind_indices x) (ind_ctors x) (ind_cunivs X1)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)

forall (x0 : constructor_body) (y : list Universe.t), on_constructor P (Σ, udecl) m n x (ind_indices x) x0 y -> on_constructor Q (Σ, ind_universes m) m n x (ind_indices x) x0 y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)

forall (x0 : constructor_body) (y : list Universe.t), on_constructor P (Σ, udecl) m n x (ind_indices x) x0 y -> on_constructor Q (Σ, ind_universes m) m n x (ind_indices x) x0 y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
X2:on_constructor P (Σ, udecl) m n x (ind_indices x) x0 y

on_constructor Q (Σ, ind_universes m) m n x (ind_indices x) x0 y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0

on_type Q (Σ, ind_universes m) (arities_context (ind_bodies m)) (cstr_type x0)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0
sorts_local_ctx Q (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0
TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0

on_type Q (Σ, ind_universes m) (arities_context (ind_bodies m)) (cstr_type x0)
apply X; eauto.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0

sorts_local_ctx Q (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x0:constructor_body
y:list Universe.t
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y

sorts_local_ctx Q (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x0:constructor_body
y:list Universe.t

sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y -> sorts_local_ctx Q (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x0:constructor_body
y:list Universe.t

forall (c : context) (y0 : list Universe.t), sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) c y0 -> sorts_local_ctx Q (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m) c y0
induction c; destruct y0; simpl; auto; destruct a as [na [b|] ty]; simpl in *; auto; split; intuition eauto.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
X11:All2 (on_constructor P (Σ, udecl) m n x (ind_indices x)) (ind_ctors x) (ind_cunivs X1)
x0:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x0) = cstr_arity x0
cstr_eq:cstr_type x0 = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (cstr_args x0) (cstr_concl m n x x0))
on_ctype:on_type P (Σ, udecl) (arities_context (ind_bodies m)) (cstr_type x0)
on_cargs:sorts_local_ctx P (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m) (cstr_args x0) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
on_ctype_positive:positive_cstr m n [] (cstr_type x0)
on_ctype_variance:forall v : list Variance.t, ind_variance m = Some v -> cstr_respects_variance (Σ, udecl) m v x0

TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x:one_inductive_body
x0:constructor_body
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))

TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x:one_inductive_body
x0:constructor_body

TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x))) -> TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) (List.rev (lift_context #|cstr_args x0| 0 (ind_indices x)))
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x:one_inductive_body
x0:constructor_body

forall l : list context_decl, TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) l -> TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) (cstr_indices x0) l
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
m:mutual_inductive_body
X0:on_global_env P Σ
udecl:=ind_universes m:universes_decl
x:one_inductive_body
x0:constructor_body

forall (l : list term) (l0 : list context_decl), TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => P Σ0 Γ t (Some T)) (Σ, udecl) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) l l0 -> TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => Q Σ0 Γ t (Some T)) (Σ, ind_universes m) (arities_context (ind_bodies m),,, ind_params m,,, cstr_args x0) l l0
induction 1; simpl; constructor; auto.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x
H0:ind_projs x <> []

match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
apply (onProjections X1 H0).
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

check_ind_sorts Q (Σ, ind_universes m) (ind_params m) (ind_kelim x) (ind_indices x) (ind_cunivs X1) (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_ind_sorts P (Σ, udecl) (ind_params m) (ind_kelim x) (ind_indices x) ind_cunivs (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

check_ind_sorts Q (Σ, ind_universes m) (ind_params m) (ind_kelim x) (ind_indices x) (Typing.ind_cunivs {| ind_arity_eq := ind_arity_eq; onArity := onArity; ind_cunivs := ind_cunivs; onConstructors := onConstructors; onProjections := onProjections; ind_sorts := ind_sorts; onIndices := onIndices |}) (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_ind_sorts P (Σ, udecl) (ind_params m) (ind_kelim x) (ind_indices x) ind_cunivs (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

check_ind_sorts Q (Σ, ind_universes m) (ind_params m) (ind_kelim x) (ind_indices x) ind_cunivs (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:if Universe.is_prop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_prop_ind ind_cunivs)) else if Universe.is_sprop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_sprop_ind ind_cunivs)) else check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

if Universe.is_prop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_prop_ind ind_cunivs)) else if Universe.is_sprop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_sprop_ind ind_cunivs)) else check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, ind_universes m)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x) else True)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:if Universe.is_sprop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_sprop_ind ind_cunivs)) else check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

if Universe.is_sprop (ind_sort x) then is_true (allowed_eliminations_subset (ind_kelim x) (elim_sort_sprop_ind ind_cunivs)) else check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, ind_universes m)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x) else True)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, ind_universes m)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x) else True)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, ind_universes m)) ind_cunivs (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)
if indices_matter then type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x) else True
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * (if indices_matter then type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x) else True)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

if indices_matter then type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x) else True
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

type_local_ctx Q (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

type_local_ctx ?P (Σ, ind_universes m) (ind_params m) (ind_indices x) (ind_sort x)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)
forall (Γ : context) (t : term) (T : option term), ?P (Σ, ind_universes m) Γ t T -> Q (Σ, ind_universes m) Γ t T
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
ind_arity_eq:ind_type x = it_mkProd_or_LetIn (ind_params m) (it_mkProd_or_LetIn (ind_indices x) (tSort (ind_sort x)))
onArity:on_type P (Σ, udecl) [] (ind_type x)
ind_cunivs:list constructor_univs
onConstructors:on_constructors P (Σ, udecl) m n x (ind_indices x) (ind_ctors x) ind_cunivs
onProjections:ind_projs x <> [] -> match ind_ctors x with | [] => False | [o0] => on_projections m kn n x (ind_indices x) o0 | o0 :: _ :: _ => False end
ind_sorts:check_constructors_smaller (TemplateLookup.global_ext_constraints (Σ, udecl)) ind_cunivs (ind_sort x) * type_local_ctx P (Σ, udecl) (ind_params m) (ind_indices x) (ind_sort x)
onIndices:forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, udecl) m v (ind_indices x)

forall (Γ : context) (t : term) (T : option term), P (Σ, ind_universes m) Γ t T -> Q (Σ, ind_universes m) Γ t T
auto.
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
n:nat
x:one_inductive_body
X1:on_ind_body P (Σ, udecl) kn m n x

forall v : list Variance.t, ind_variance m = Some v -> ind_respects_variance (Σ, ind_universes m) m v (ind_indices x)
apply (onIndices X1).
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:on_context P (Σ, udecl) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

on_context Q (Σ, ind_universes m) (ind_params m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

on_context Q (Σ, ind_universes m) (ind_params m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

TemplateEnvTyping.All_local_env (Q (Σ, ind_universes m)) (ind_params m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

TemplateEnvTyping.All_local_env ?P (ind_params m)
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
forall (Γ : context) (t : term) (T : option term), ?P Γ t T -> Q (Σ, ind_universes m) Γ t T
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ : context) (t : term) (T : option term), on_global_env P Σ0.1 -> P Σ0 Γ t T -> Q Σ0 Γ t T
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)

forall (Γ : context) (t : term) (T : option term), P (Σ, udecl) Γ t T -> Q (Σ, ind_universes m) Γ t T
H:checker_flags
P:global_env_ext -> context -> term -> option term -> Type
Q:global_env × universes_decl -> context -> term -> option term -> Type
X:forall (Σ0 : global_env × universes_decl) (Γ0 : context) (t0 : term) (T0 : option term), on_global_env P Σ0.1 -> P Σ0 Γ0 t0 T0 -> Q Σ0 Γ0 t0 T0
Σ:global_env
kn:kername
m:mutual_inductive_body
X0:on_global_env P Σ
f:fresh_global kn Σ
udecl:=ind_universes m:universes_decl
o:on_udecl Σ udecl
onI:Alli (on_ind_body P (Σ, udecl) kn m) 0 (ind_bodies m)
onP:TemplateEnvTyping.All_local_env (P (Σ, udecl)) (ind_params m)
onNP:context_assumptions (ind_params m) = ind_npars m
onVariance:on_variance (ind_universes m) (ind_variance m)
Γ:context
t:term
T:option term
X1:P (Σ, udecl) Γ t T

Q (Σ, ind_universes m) Γ t T
now apply X. Qed.

forall (a : context_decl) (Γ : list context_decl), All_local_env wf_decl_pred (a :: Γ) -> on_local_decl wf_decl_pred Γ a × All_local_env wf_decl_pred Γ

forall (a : context_decl) (Γ : list context_decl), All_local_env wf_decl_pred (a :: Γ) -> on_local_decl wf_decl_pred Γ a × All_local_env wf_decl_pred Γ
a:context_decl
Γ:list context_decl
X:All_local_env wf_decl_pred (a :: Γ)

on_local_decl wf_decl_pred Γ a * All_local_env wf_decl_pred Γ
inv X; intuition; red; simpl; eauto. Qed.
t:term

Ast.wf t -> Ast.wf (strip_outer_cast t)
t:term

Ast.wf t -> Ast.wf (strip_outer_cast t)
t1:term
kind:cast_kind
t2:term
IHt1:Ast.wf t1 -> Ast.wf (strip_outer_cast t1)
IHt2:Ast.wf t2 -> Ast.wf (strip_outer_cast t2)

Ast.wf (tCast t1 kind t2) -> Ast.wf (strip_outer_cast (tCast t1 kind t2))
t1:term
kind:cast_kind
t2:term
IHt1:Ast.wf t1 -> Ast.wf (strip_outer_cast t1)
IHt2:Ast.wf t2 -> Ast.wf (strip_outer_cast t2)

Ast.wf (tCast t1 kind t2) -> Ast.wf (strip_outer_cast t1)
intros H; now inv H. Qed.
t:term
u:list term

~~ isApp t -> Ast.wf (mkApps t u) -> Ast.wf t /\ Forall Ast.wf u
t:term
u:list term

~~ isApp t -> Ast.wf (mkApps t u) -> Ast.wf t /\ Forall Ast.wf u
t:term

~~ isApp t -> Ast.wf t -> Ast.wf t /\ Forall Ast.wf []
t, a:term
u:list term
IHu:forall t0 : term, ~~ isApp t0 -> Ast.wf (mkApps t0 u) -> Ast.wf t0 /\ Forall Ast.wf u
~~ isApp t -> Ast.wf match t with | tApp f args => tApp f (args ++ a :: u) | _ => tApp t (a :: u) end -> Ast.wf t /\ Forall Ast.wf (a :: u)
t:term

~~ isApp t -> Ast.wf t -> Ast.wf t /\ Forall Ast.wf []
intuition.
t, a:term
u:list term
IHu:forall t0 : term, ~~ isApp t0 -> Ast.wf (mkApps t0 u) -> Ast.wf t0 /\ Forall Ast.wf u

~~ isApp t -> Ast.wf match t with | tApp f args => tApp f (args ++ a :: u) | _ => tApp t (a :: u) end -> Ast.wf t /\ Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:forall t0 : term, ~~ isApp t0 -> Ast.wf (mkApps t0 u) -> Ast.wf t0 /\ Forall Ast.wf u
Happ:is_true (~~ isApp (tApp t args))
H:Ast.wf (tApp t (args ++ a :: u))

Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:~~ isApp (tApp t (u ++ [a])) -> Ast.wf (mkApps (tApp t (u ++ [a])) u) -> Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ:is_true (~~ isApp (tApp t args))
H:Ast.wf (tApp t (args ++ a :: u))

Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:~~ isApp (tApp t (u ++ [a])) -> Ast.wf (mkApps (tApp t (u ++ [a])) u) -> Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ:is_true (~~ isApp (tApp t args))
H:Ast.wf (tApp t (args ++ a :: u))

is_true (~~ isApp (tApp t (u ++ [a])))
t:term
args:list term
a:term
u:list term
IHu:Ast.wf (mkApps (tApp t (u ++ [a])) u) -> Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ:is_true (~~ isApp (tApp t args))
H:Ast.wf (tApp t (args ++ a :: u))
Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Ast.wf (mkApps (tApp t (u ++ [a])) u) -> Ast.wf (tApp t (u ++ [a])) /\ Forall Ast.wf u
Happ:is_true (~~ isApp (tApp t args))
H:Ast.wf (tApp t (args ++ a :: u))

Ast.wf (tApp t args) /\ Forall Ast.wf (a :: u)
discriminate. Qed. Hint Resolve wf_mkApps_napp : wf.
t:term
u:list term

Ast.wf (mkApps t u) -> Forall Ast.wf u
t:term
u:list term

Ast.wf (mkApps t u) -> Forall Ast.wf u
t:term

Ast.wf t -> Forall Ast.wf []
t, a:term
u:list term
IHu:forall t0 : term, Ast.wf (mkApps t0 u) -> Forall Ast.wf u
Ast.wf match t with | tApp f args => tApp f (args ++ a :: u) | _ => tApp t (a :: u) end -> Forall Ast.wf (a :: u)
t:term

Ast.wf t -> Forall Ast.wf []
intuition.
t, a:term
u:list term
IHu:forall t0 : term, Ast.wf (mkApps t0 u) -> Forall Ast.wf u

Ast.wf match t with | tApp f args => tApp f (args ++ a :: u) | _ => tApp t (a :: u) end -> Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:forall t0 : term, Ast.wf (mkApps t0 u) -> Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))

Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))

Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))

Ast.wf (mkApps (tApp t (args ++ [a])) u)
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
t:term
args:list term
a, a0:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) -> Forall Ast.wf (a0 :: u)
H:Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0:(Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u) -> Ast.wf (tApp t (args ++ a :: u)) -> Ast.wf (mkApps (tApp t (args ++ [a])) u)

Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u))
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
t:term
args:list term
a, a0:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) -> Forall Ast.wf (a0 :: u)
H:Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0:(Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u) -> Ast.wf (tApp t (args ++ a :: u)) -> Ast.wf (mkApps (tApp t (args ++ [a])) u)

Ast.wf (tApp t ((args ++ [a]) ++ a0 :: u))
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
t:term
args:list term
a, a0:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) -> Forall Ast.wf (a0 :: u)
H:Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0:(Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u) -> Ast.wf (tApp t (args ++ a :: u)) -> Ast.wf (mkApps (tApp t (args ++ [a])) u)

Ast.wf (tApp t (args ++ [a] ++ a0 :: u))
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
t:term
args:list term
a, a0:term
u:list term
IHu:Ast.wf (mkApps (tApp t (args ++ [a])) (a0 :: u)) -> Forall Ast.wf (a0 :: u)
H:Ast.wf (tApp t (args ++ a :: a0 :: u))
IHu0:(Ast.wf (mkApps (tApp t (args ++ [a])) u) -> Forall Ast.wf u) -> Ast.wf (tApp t (args ++ a :: u)) -> Ast.wf (mkApps (tApp t (args ++ [a])) u)

Ast.wf (tApp t (args ++ a :: a0 :: u))
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))
Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))

Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H:Ast.wf (tApp t (args ++ a :: u))

Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H0:isApp t = false
H1:args ++ a :: u <> []
H2:Ast.wf t
H3:Forall Ast.wf (args ++ a :: u)

Forall Ast.wf (a :: u)
t:term
args:list term
a:term
u:list term
IHu:Forall Ast.wf u
H0:isApp t = false
H1:args ++ a :: u <> []
H2:Ast.wf t
H3:Forall Ast.wf args /\ Forall Ast.wf (a :: u)

Forall Ast.wf (a :: u)
intuition. Qed. Hint Resolve wf_mkApps_inv : wf. Hint Constructors Ast.wf : wf.
t:term

isLambda t = true -> ~~ isApp t
t:term

isLambda t = true -> ~~ isApp t
destruct t; simpl; congruence. Qed.

forall (mfix : mfixpoint term) (idx narg : nat) (fn : term), unfold_fix mfix idx = Some (narg, fn) -> Ast.wf (tFix mfix idx) -> Ast.wf fn

forall (mfix : mfixpoint term) (idx narg : nat) (fn : term), unfold_fix mfix idx = Some (narg, fn) -> Ast.wf (tFix mfix idx) -> Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:unfold_fix mfix idx = Some (narg, fn)
Hwf:Ast.wf (tFix mfix idx)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:match nth_error mfix idx with | Some d => Some (rarg d, subst0 (fix_subst mfix) (dbody d)) | None => None end = Some (narg, fn)
Hwf:Ast.wf (tFix mfix idx)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:match nth_error mfix idx with | Some d => Some (rarg d, subst0 (fix_subst mfix) (dbody d)) | None => None end = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:(fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) d

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:Ast.wf (dtype d) /\ Ast.wf (dbody d)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

subst0 (fix_subst mfix) (dbody d) = fn -> rarg d = narg -> Ast.wf fn
mfix:mfixpoint term
idx:nat
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (rarg d, subst0 (fix_subst mfix) (dbody d))
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

Ast.wf (subst0 (fix_subst mfix) (dbody d))
mfix:mfixpoint term
idx:nat
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (fix_subst mfix) (dbody d)) = Some (rarg d, subst0 (fix_subst mfix) (dbody d))
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

Forall Ast.wf (fix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Forall Ast.wf (fix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

forall n : nat, Ast.wf (tFix mfix n)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tFix mfix n)
Forall Ast.wf (fix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tFix mfix n)

Forall Ast.wf (fix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tFix mfix n)

Forall Ast.wf ((fix aux (n : nat) : list term := match n with | 0 => [] | S n0 => tFix mfix n0 :: aux n0 end) #|mfix|)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n0 : nat, Ast.wf (tFix mfix n0)
n:nat

Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tFix mfix n1 :: aux n1 end) n)
induction n; auto. Qed.

forall (mfix : mfixpoint term) (idx narg : nat) (fn : term), unfold_cofix mfix idx = Some (narg, fn) -> Ast.wf (tCoFix mfix idx) -> Ast.wf fn

forall (mfix : mfixpoint term) (idx narg : nat) (fn : term), unfold_cofix mfix idx = Some (narg, fn) -> Ast.wf (tCoFix mfix idx) -> Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:unfold_cofix mfix idx = Some (narg, fn)
Hwf:Ast.wf (tCoFix mfix idx)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:match nth_error mfix idx with | Some d => Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) | None => None end = Some (narg, fn)
Hwf:Ast.wf (tCoFix mfix idx)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
Hf:match nth_error mfix idx with | Some d => Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) | None => None end = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:(fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) d

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:Ast.wf (dtype d) /\ Ast.wf (dbody d)

Ast.wf fn
mfix:mfixpoint term
idx, narg:nat
fn:term
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (narg, fn)
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:Ast.wf (dtype d) /\ Ast.wf (dbody d)

subst0 (cofix_subst mfix) (dbody d) = fn -> rarg d = narg -> Ast.wf fn
mfix:mfixpoint term
idx:nat
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (rarg d, subst0 (cofix_subst mfix) (dbody d))
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:Ast.wf (dtype d) /\ Ast.wf (dbody d)

Ast.wf (subst0 (cofix_subst mfix) (dbody d))
mfix:mfixpoint term
idx:nat
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (rarg d, subst0 (cofix_subst mfix) (dbody d))
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

Ast.wf (subst0 (cofix_subst mfix) (dbody d))
mfix:mfixpoint term
idx:nat
d:def term
eqnth:nth_error mfix idx = Some d
Hf:Some (rarg d, subst0 (cofix_subst mfix) (dbody d)) = Some (rarg d, subst0 (cofix_subst mfix) (dbody d))
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
wfd:Ast.wf (dbody d)

Forall Ast.wf (cofix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

Forall Ast.wf (cofix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix

forall n : nat, Ast.wf (tCoFix mfix n)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tCoFix mfix n)
Forall Ast.wf (cofix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tCoFix mfix n)

Forall Ast.wf (cofix_subst mfix)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n : nat, Ast.wf (tCoFix mfix n)

Forall Ast.wf ((fix aux (n : nat) : list term := match n with | 0 => [] | S n0 => tCoFix mfix n0 :: aux n0 end) #|mfix|)
mfix:mfixpoint term
idx:nat
d:def term
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
H0:forall n0 : nat, Ast.wf (tCoFix mfix n0)
n:nat

Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tCoFix mfix n1 :: aux n1 end) n)
induction n; auto. Qed.
u:Instance.t
c:term

Ast.wf c -> Ast.wf (subst_instance u c)
u:Instance.t
c:term

Ast.wf c -> Ast.wf (subst_instance u c)
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

Ast.wf (subst_instance u (tApp t l))
u:Instance.t
ci:case_info
p0:predicate term
X:tCasePredProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) p0
t:term
l:list (branch term)
X0:tCaseBrsProp (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)
Ast.wf (subst_instance u (tCase ci p0 t l))
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m
Ast.wf (subst_instance u (tFix m n))
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m
Ast.wf (subst_instance u (tCoFix m n))
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

Ast.wf (subst_instance u (tApp t l))
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

isApp ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u t) = false
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)
map ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) l <> []
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)
Forall Ast.wf (map ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) l)
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

map ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) l <> []
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)
Forall Ast.wf (map ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) l)
u:Instance.t
t:term
H:isApp t = false
H0:Ast.wf t
l:list term
H1:l <> []
H2:Forall Ast.wf l
H3:Forall (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

Forall Ast.wf (map ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) l)
now apply Forall_map.
u:Instance.t
ci:case_info
p0:predicate term
X:tCasePredProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) p0
t:term
l:list (branch term)
X0:tCaseBrsProp (fun c : term => Ast.wf (subst_instance u c)) l
IHwf:Ast.wf (subst_instance u t)

Ast.wf (subst_instance u (tCase ci p0 t l))
constructor; auto; simpl; solve_all.
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m

Ast.wf (subst_instance u (tFix m n))
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) (map (map_def ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u)) m)
solve_all.
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m

Ast.wf (subst_instance u (tCoFix m n))
u:Instance.t
m:mfixpoint term
n:nat
X:tFixProp (fun c : term => Ast.wf (subst_instance u c)) (fun c : term => Ast.wf (subst_instance u c)) m

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) (map (map_def ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u) ((fix subst_instance_constr (u0 : Instance.t) (c : term) {struct c} : term := match c with | tEvar ev args => tEvar ev (map (subst_instance_constr u0) args) | tSort s => tSort (subst_instance_univ u0 s) | tCast c0 kind ty => tCast (subst_instance_constr u0 c0) kind (subst_instance_constr u0 ty) | tProd na A B => tProd na (subst_instance_constr u0 A) (subst_instance_constr u0 B) | tLambda na T M => tLambda na (subst_instance_constr u0 T) (subst_instance_constr u0 M) | tLetIn na b ty b' => tLetIn na (subst_instance_constr u0 b) (subst_instance_constr u0 ty) (subst_instance_constr u0 b') | tApp f v => tApp (subst_instance_constr u0 f) (map (subst_instance_constr u0) v) | tConst c0 u' => tConst c0 (subst_instance_instance u0 u') | tInd i u' => tInd i (subst_instance_instance u0 u') | tConstruct ind k u' => tConstruct ind k (subst_instance_instance u0 u') | tCase ind p c0 brs => let p' := map_predicate (subst_instance_instance u0) (subst_instance_constr u0) (subst_instance_constr u0) p in let brs' := map (map_branch (subst_instance_constr u0)) brs in tCase ind p' (subst_instance_constr u0 c0) brs' | tProj p c0 => tProj p (subst_instance_constr u0 c0) | tFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tFix mfix' idx | tCoFix mfix idx => let mfix' := map (map_def (subst_instance_constr u0) (subst_instance_constr u0)) mfix in tCoFix mfix' idx | _ => c end) u)) m)
solve_all. Qed.

forall (n : nat) (args : list term), Forall Ast.wf args -> Ast.wf (nth n args tDummy)

forall (n : nat) (args : list term), Forall Ast.wf args -> Ast.wf (nth n args tDummy)
n:nat
args:list term
H:Forall Ast.wf args

Ast.wf (nth n args tDummy)
induction H in n; destruct n; simpl; try constructor; auto. Qed. Hint Resolve wf_nth : core.
Σ:global_env
Γ:context
t, u:term

red1 Σ Γ t u -> isLambda t -> isLambda u
Σ:global_env
Γ:context
t, u:term

red1 Σ Γ t u -> isLambda t -> isLambda u
induction 1 using red1_ind_all; simpl; try discriminate; auto. Qed.
A:Type
P:A -> A -> Type
Q:A -> Type
l, l':list A

OnOne2 P l l' -> (forall x y : A, P x y -> Q x -> Q y) -> All Q l -> All Q l'
A:Type
P:A -> A -> Type
Q:A -> Type
l, l':list A

OnOne2 P l l' -> (forall x y : A, P x y -> Q x -> Q y) -> All Q l -> All Q l'
A:Type
P:A -> A -> Type
Q:A -> Type
l, l':list A
Hl:OnOne2 P l l'
H:forall x y : A, P x y -> Q x -> Q y

All Q l -> All Q l'
induction Hl; intros H'; inv H'; constructor; eauto. Qed.
A, B:Type
P:B -> Type
l:list A
f:nat -> A -> B

Alli (fun (i : nat) (x : A) => P (f i x)) 0 l -> All P (mapi f l)
A, B:Type
P:B -> Type
l:list A
f:nat -> A -> B

Alli (fun (i : nat) (x : A) => P (f i x)) 0 l -> All P (mapi f l)
A, B:Type
P:B -> Type
l:list A
f:nat -> A -> B

Alli (fun (i : nat) (x : A) => P (f i x)) 0 l -> All P (mapi_rec f l 0)
A, B:Type
P:B -> Type
l:list A
f:nat -> A -> B

forall n : nat, Alli (fun (i : nat) (x : A) => P (f i x)) n l -> All P (mapi_rec f l n)
induction 1; constructor; auto. Qed.
A:Type
P:nat -> A -> Type
n:nat
l:list A

(forall (n0 : nat) (x : A), P n0 x) -> Alli P n l
A:Type
P:nat -> A -> Type
n:nat
l:list A

(forall (n0 : nat) (x : A), P n0 x) -> Alli P n l
A:Type
P:nat -> A -> Type
n:nat
l:list A
H:forall (n0 : nat) (x : A), P n0 x

Alli P n l
induction l in n |- *; constructor; auto. Qed.
A:Type
P:A -> Type
Q:nat -> A -> Type
l:list A
n:nat

All P l -> (forall (n0 : nat) (x : A), P x -> Q n0 x) -> Alli Q n l
A:Type
P:A -> Type
Q:nat -> A -> Type
l:list A
n:nat

All P l -> (forall (n0 : nat) (x : A), P x -> Q n0 x) -> Alli Q n l
A:Type
P:A -> Type
Q:nat -> A -> Type
l:list A
n:nat
H:All P l

(forall (n0 : nat) (x : A), P x -> Q n0 x) -> Alli Q n l
A:Type
P:A -> Type
Q:nat -> A -> Type
l:list A
H:All P l

forall n : nat, (forall (n0 : nat) (x : A), P x -> Q n0 x) -> Alli Q n l
induction H; constructor; eauto. Qed. Ltac wf := intuition try (eauto with wf || congruence || solve [constructor]). Hint Unfold wf_decl vass vdef : wf. Hint Extern 10 => progress simpl : wf. Hint Unfold snoc : wf. Hint Extern 3 => apply wf_lift || apply wf_subst || apply wf_subst_instance : wf. Hint Extern 10 => constructor : wf. Hint Resolve All_skipn : wf.
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Ast.wf (ind_type idecl)
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
H:declared_inductive Σ ind mdecl idecl

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:declared_minductive Σ (inductive_mind ind) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) (InductiveDecl mdecl)

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl

Ast.wf (ind_type idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_type (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' [] (ind_type idecl)

Ast.wf (ind_type idecl)
destruct Hidecl as [s Hs]; wf. Qed.
Γ:context
t:term

Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t
Γ:context
t:term

Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t
Γ:context

forall t : term, Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t
a:context_decl
Γ:list context_decl
IHΓ:forall t : term, Ast.wf (it_mkProd_or_LetIn Γ t) -> Forall wf_decl Γ /\ Ast.wf t

forall t : term, Ast.wf (it_mkProd_or_LetIn (a :: Γ) t) -> Forall wf_decl (a :: Γ) /\ Ast.wf t
a:context_decl
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
XX:Ast.wf (it_mkProd_or_LetIn (a :: Γ) t)

Forall wf_decl (a :: Γ) /\ Ast.wf t
decl_name:aname
t0, decl_type:term
Γ:list context_decl
IHΓ:forall t1 : term, Ast.wf (it_mkProd_or_LetIn Γ t1) -> Forall wf_decl Γ /\ Ast.wf t1
t:term
XX:Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn {| decl_name := decl_name; decl_body := Some t0; decl_type := decl_type |} t))

Forall wf_decl ({| decl_name := decl_name; decl_body := Some t0; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
XX:Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn {| decl_name := decl_name; decl_body := None; decl_type := decl_type |} t))
Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
t0, decl_type:term
Γ:list context_decl
IHΓ:forall t1 : term, Ast.wf (it_mkProd_or_LetIn Γ t1) -> Forall wf_decl Γ /\ Ast.wf t1
t:term
H:Forall wf_decl Γ
H0:Ast.wf (mkProd_or_LetIn {| decl_name := decl_name; decl_body := Some t0; decl_type := decl_type |} t)

Forall wf_decl ({| decl_name := decl_name; decl_body := Some t0; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
XX:Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn {| decl_name := decl_name; decl_body := None; decl_type := decl_type |} t))
Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
XX:Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn {| decl_name := decl_name; decl_body := None; decl_type := decl_type |} t))

Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
H:Forall wf_decl Γ
H0:Ast.wf (mkProd_or_LetIn {| decl_name := decl_name; decl_body := None; decl_type := decl_type |} t)

Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
H:Forall wf_decl Γ
H0_:Ast.wf (BasicAst.decl_type {| decl_name := decl_name; decl_body := None; decl_type := decl_type |})
H0_0:Ast.wf t

Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
H:Forall wf_decl Γ
H0_:Ast.wf decl_type
H0_0:Ast.wf t

Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ) /\ Ast.wf t
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall t0 : term, Ast.wf (it_mkProd_or_LetIn Γ t0) -> Forall wf_decl Γ /\ Ast.wf t0
t:term
H:Forall wf_decl Γ
H0_:Ast.wf decl_type
H0_0:Ast.wf t

Forall wf_decl ({| decl_name := decl_name; decl_body := None; decl_type := decl_type |} :: Γ)
constructor; auto with wf. Qed.
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_indices idecl)
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
H:declared_inductive Σ ind mdecl idecl

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:declared_minductive Σ (inductive_mind ind) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) (InductiveDecl mdecl)

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
X:on_type (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' [] (ind_type idecl)

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
X:on_type (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' [] (it_mkProd_or_LetIn (ind_params mdecl) (it_mkProd_or_LetIn (ind_indices idecl) (tSort (ind_sort idecl))))

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
s:Universe.t
H:Ast.wf (it_mkProd_or_LetIn (ind_params mdecl) (it_mkProd_or_LetIn (ind_indices idecl) (tSort (ind_sort idecl))))
H0:Ast.wf (tSort s)

Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
s:Universe.t
H0:Ast.wf (tSort s)
H1:Forall wf_decl (ind_params mdecl)
H:Ast.wf (it_mkProd_or_LetIn (ind_indices idecl) (tSort (ind_sort idecl)))

Forall wf_decl (ind_indices idecl)
now eapply it_mkProd_or_LetIn_wf in H. Qed.
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_inductive Σ ind mdecl idecl -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
H:declared_inductive Σ ind mdecl idecl

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:declared_minductive Σ (inductive_mind ind) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) (InductiveDecl mdecl)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
X:on_constructors (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (0 + inductive_ind ind) idecl (ind_indices idecl) (ind_ctors idecl) (ind_cunivs Hidecl)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
X:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (0 + inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
x:constructor_body
y:list Universe.t
X:on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl) x y

All wf_decl (cstr_args x)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (0 + inductive_ind ind) idecl
x:constructor_body
y:list Universe.t
cstr_args_length:context_assumptions (cstr_args x) = cstr_arity x
cstr_eq:cstr_type x = it_mkProd_or_LetIn (ind_params mdecl) (it_mkProd_or_LetIn (cstr_args x) (cstr_concl mdecl (inductive_ind ind) idecl x))
on_ctype:on_type (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl)) (cstr_type x)
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T0 : term) => Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t (Some T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl,,, cstr_args x) (cstr_indices x) (List.rev (lift_context #|cstr_args x| 0 (ind_indices idecl)))
on_ctype_positive:positive_cstr mdecl (inductive_ind ind) [] (cstr_type x)
on_ctype_variance:forall v : list Variance.t, ind_variance mdecl = Some v -> cstr_respects_variance Σ' mdecl v x

All wf_decl (cstr_args x)
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y

All wf_decl (cstr_args x)
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args
All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

match decl_body {| decl_name := na; decl_body := None; decl_type := ty |} with | Some b => Ast.wf b | None => True end /\ Ast.wf (decl_type {| decl_name := na; decl_body := None; decl_type := ty |})
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args
All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

True /\ Ast.wf ty
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args
All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
t:Universe.t
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y * (Ast.wf ty /\ Ast.wf (tSort t))
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

True /\ Ast.wf ty
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args
All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:match y with | [] => False | u :: us => sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args us * (Ast.wf ty /\ Ast.wf (tSort u)) end
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
t:Universe.t
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y * (Ast.wf ty /\ Ast.wf (tSort t))
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

All wf_decl args
mdecl:mutual_inductive_body
Σ':global_env * universes_decl
x:constructor_body
t:Universe.t
y:list Universe.t
na:aname
ty:term
args:list context_decl
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y * (Ast.wf ty /\ Ast.wf (tSort t))
IHargs:forall y0 : list Universe.t, sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args y0 -> All wf_decl args

sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) args ?y
intuition eauto. Qed.
ctx:context

TemplateEnvTyping.All_local_env wf_decl_pred ctx -> Forall wf_decl ctx
ctx:context

TemplateEnvTyping.All_local_env wf_decl_pred ctx -> Forall wf_decl ctx
Γ:context
na:aname
t:term
X:TemplateEnvTyping.All_local_env wf_decl_pred Γ
t0:wf_decl_pred Γ t None
IHX:Forall wf_decl Γ

wf_decl (vass na t)
Γ:context
na:aname
t:term
X:TemplateEnvTyping.All_local_env wf_decl_pred Γ
s:Ast.wf t
Hs:True
IHX:Forall wf_decl Γ

wf_decl (vass na t)
split; simpl; intuition auto. Qed.
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_params mdecl)
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (mdecl : mutual_inductive_body) (idecl : one_inductive_body), on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_inductive Σ ind mdecl idecl -> Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
H:declared_inductive Σ ind mdecl idecl

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Hmdecl:declared_minductive Σ (inductive_mind ind) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
X:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf:on_global_decl (fun _ : global_env_ext => wf_decl_pred) Σ' (inductive_mind ind) (InductiveDecl mdecl)

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf:on_context (fun _ : global_env_ext => wf_decl_pred) Σ' (ind_params mdecl)

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind ind) = Some idecl
Σ':global_env * universes_decl
wfΣ':on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf:TemplateEnvTyping.All_local_env wf_decl_pred (ind_params mdecl)

Forall wf_decl (ind_params mdecl)
now apply All_local_env_wf_decls in prf. Qed.
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (i : nat), list Level.t -> forall (mdecl : mutual_inductive_body) (idecl : one_inductive_body) (cdecl : constructor_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_constructor Σ (ind, i) mdecl idecl cdecl -> Ast.wf (cstr_type cdecl)
cf:checker_flags

forall (Σ : global_env) (ind : inductive) (i : nat), list Level.t -> forall (mdecl : mutual_inductive_body) (idecl : one_inductive_body) (cdecl : constructor_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_constructor Σ (ind, i) mdecl idecl cdecl -> Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
isdecl:declared_constructor Σ (ind, i) mdecl idecl cdecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:declared_minductive Σ (inductive_mind (ind, i).1) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind (ind, i).1) = Some idecl
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Hmdecl:lookup_env Σ (inductive_mind (ind, i).1) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind (ind, i).1) = Some idecl
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind (ind, i).1) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind (ind, i).1) = Some idecl
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind (ind, i).1) (InductiveDecl mdecl)

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind (ind, i).1) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind (ind, i).1) = Some idecl
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_inductive (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind (ind, i).1) mdecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind (ind, i).1) = Some (InductiveDecl mdecl)
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind (ind, i).1) = Some idecl
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind (ind, i).1) mdecl) 0 (ind_bodies mdecl)

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind (ind, i).1) = Some (InductiveDecl mdecl)
Hcdecl:nth_error (ind_ctors idecl) (ind, i).2 = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind (ind, i).1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind (ind, i).1) mdecl (0 + inductive_ind (ind, i).1) idecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hcdecl:nth_error (ind_ctors idecl) i = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hcdecl:nth_error (ind_ctors idecl) i = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:on_constructors (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl) (ind_ctors idecl) (ind_cunivs Hidecl)

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hcdecl:nth_error (ind_ctors idecl) i = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)
Hcdecl:∑ t' : ?B, nth_error ?l' i = Some t' × ?P cdecl t'

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Hcdecl:nth_error (ind_ctors idecl) i = Some cdecl
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)
All2 ?P (ind_ctors idecl) ?l'
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)
Hcdecl:∑ t' : list Universe.t, nth_error (ind_cunivs Hidecl) i = Some t' × on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl) cdecl t'

Ast.wf (cstr_type cdecl)
cf:checker_flags
Σ:global_env
ind:inductive
i:nat
u:list Level.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
Hmdecl:lookup_env Σ (inductive_mind ind) = Some (InductiveDecl mdecl)
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs Hidecl)
cs:list Universe.t
Hnth:nth_error (ind_cunivs Hidecl) i = Some cs
cstr_args_length:context_assumptions (cstr_args cdecl) = cstr_arity cdecl
cstr_eq:cstr_type cdecl = it_mkProd_or_LetIn (ind_params mdecl) (it_mkProd_or_LetIn (cstr_args cdecl) (cstr_concl mdecl (inductive_ind ind) idecl cdecl))
x:Universe.t
H:Ast.wf (cstr_type cdecl)
H0:Ast.wf (tSort x)
on_cargs:sorts_local_ctx (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args cdecl) cs
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T0 : term) => Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t (Some T)) Σ' (arities_context (ind_bodies mdecl),,, ind_params mdecl,,, cstr_args cdecl) (cstr_indices cdecl) (List.rev (lift_context #|cstr_args cdecl| 0 (ind_indices idecl)))
on_ctype_positive:positive_cstr mdecl (inductive_ind ind) [] (cstr_type cdecl)
on_ctype_variance:forall v : list Variance.t, ind_variance mdecl = Some v -> cstr_respects_variance Σ' mdecl v cdecl

Ast.wf (cstr_type cdecl)
assumption. Qed.
ctx:list context_decl
T:term

match destArity ctx T with | Some (ctx', s) => it_mkProd_or_LetIn ctx T = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
T:term

match destArity ctx T with | Some (ctx', s) => it_mkProd_or_LetIn ctx T = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
na:aname
T1, T2:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:forall ctx0 : list context_decl, match destArity ctx0 T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end

match destArity (ctx,, vass na T1) T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tProd na T1 T2) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
na:aname
T1, T2, T3:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:forall ctx0 : list context_decl, match destArity ctx0 T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT3:forall ctx0 : list context_decl, match destArity ctx0 T3 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T3 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
match destArity (ctx,, vdef na T1 T2) T3 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tLetIn na T1 T2 T3) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
na:aname
T1, T2:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:forall ctx0 : list context_decl, match destArity ctx0 T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end

match destArity (ctx,, vass na T1) T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tProd na T1 T2) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
na:aname
T1, T2:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:match destArity (ctx,, vass na T1) T2 with | Some (ctx', s) => it_mkProd_or_LetIn (ctx,, vass na T1) T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end

match destArity (ctx,, vass na T1) T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tProd na T1 T2) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
now destruct destArity.
ctx:list context_decl
na:aname
T1, T2, T3:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:forall ctx0 : list context_decl, match destArity ctx0 T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT3:forall ctx0 : list context_decl, match destArity ctx0 T3 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T3 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end

match destArity (ctx,, vdef na T1 T2) T3 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tLetIn na T1 T2 T3) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
ctx:list context_decl
na:aname
T1, T2, T3:term
IHT1:forall ctx0 : list context_decl, match destArity ctx0 T1 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T1 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT2:forall ctx0 : list context_decl, match destArity ctx0 T2 with | Some (ctx', s) => it_mkProd_or_LetIn ctx0 T2 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
IHT3:match destArity (ctx,, vdef na T1 T2) T3 with | Some (ctx', s) => it_mkProd_or_LetIn (ctx,, vdef na T1 T2) T3 = it_mkProd_or_LetIn ctx' (tSort s) | None => True end

match destArity (ctx,, vdef na T1 T2) T3 with | Some (ctx', s) => it_mkProd_or_LetIn ctx (tLetIn na T1 T2 T3) = it_mkProd_or_LetIn ctx' (tSort s) | None => True end
now destruct destArity. Qed.
ctx:list context_decl
ctx':context
t:term

destArity ctx (it_mkProd_or_LetIn ctx' t) = destArity (ctx,,, ctx') t
ctx:list context_decl
ctx':context
t:term

destArity ctx (it_mkProd_or_LetIn ctx' t) = destArity (ctx,,, ctx') t
ctx:list context_decl
a:context_decl
ctx':list context_decl
t:term
IHctx':forall (ctx0 : list context_decl) (t0 : term), destArity ctx0 (it_mkProd_or_LetIn ctx' t0) = destArity (ctx0,,, ctx') t0

destArity ctx (it_mkProd_or_LetIn ctx' (mkProd_or_LetIn a t)) = destArity (a :: ctx,,, ctx') t
ctx:list context_decl
a:context_decl
ctx':list context_decl
t:term
IHctx':forall (ctx0 : list context_decl) (t0 : term), destArity ctx0 (it_mkProd_or_LetIn ctx' t0) = destArity (ctx0,,, ctx') t0

destArity (ctx,,, ctx') (mkProd_or_LetIn a t) = destArity (a :: ctx,,, ctx') t
destruct a as [na [b|] ty]; reflexivity. Qed.
ctx:context
s:Universe.t
ctx':context
s':Universe.t

it_mkProd_or_LetIn ctx (tSort s) = it_mkProd_or_LetIn ctx' (tSort s') -> ctx = ctx' /\ s = s'
ctx:context
s:Universe.t
ctx':context
s':Universe.t

it_mkProd_or_LetIn ctx (tSort s) = it_mkProd_or_LetIn ctx' (tSort s') -> ctx = ctx' /\ s = s'
ctx:context
s:Universe.t
ctx':context
s':Universe.t

destArity [] (it_mkProd_or_LetIn ctx (tSort s)) = destArity [] (it_mkProd_or_LetIn ctx' (tSort s')) -> ctx = ctx' /\ s = s'
ctx:context
s:Universe.t
ctx':context
s':Universe.t

Some ([],,, ctx, s) = Some ([],,, ctx', s') -> ctx = ctx' /\ s = s'
now rewrite !app_context_nil_l => [= -> ->]. Qed. (* Lemma case_predicate_contextP ind mdecl idecl params uinst pctx : build_case_predicate_context ind mdecl idecl params uinst = Some pctx <~> case_predicate_context ind mdecl idecl params uinst pctx. Proof. unfold build_case_predicate_context. unfold instantiate_params. destruct instantiate_params_subst as [[ictx p]|] eqn:ipars => /= //. 2:{ split => //. intros H. depelim H. eapply instantiate_params_substP in i. rewrite ipars in i. discriminate. } move: (destArity_spec [] (subst0 ictx p)). destruct destArity as [[idctx inds]|] eqn:da => //. simpl. intros eqs. split. eapply instantiate_params_substP in ipars. intros [= <-]. econstructor. eauto. eauto. intros H. depelim H. subst sty. eapply instantiate_params_substP in i. rewrite ipars in i. noconf i. rewrite eqs in e. eapply it_mkProd_or_LetIn_inj in e as [<- <-]. reflexivity. split => // [] [] s ty ictxt inds. move/instantiate_params_substP. rewrite ipars /= => [=] <- <- H. rewrite H destArity_it_mkProd_or_LetIn in da. noconf da. Qed. *)
n:nat
acc:list term
Γ:list context_decl

Forall Ast.wf acc -> Forall Ast.wf (reln acc n Γ)
n:nat
acc:list term
Γ:list context_decl

Forall Ast.wf acc -> Forall Ast.wf (reln acc n Γ)
n:nat
acc:list term
a:context_decl
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc

Forall Ast.wf match a with | {| decl_body := Some _ |} => reln acc (n + 1) Γ | {| decl_body := None |} => reln (tRel n :: acc) (n + 1) Γ end
n:nat
acc:list term
decl_name:aname
t, decl_type:term
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc

Forall Ast.wf (reln acc (n + 1) Γ)
n:nat
acc:list term
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc
Forall Ast.wf (reln (tRel n :: acc) (n + 1) Γ)
n:nat
acc:list term
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc

Forall Ast.wf (reln (tRel n :: acc) (n + 1) Γ)
n:nat
acc:list term
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc

Forall Ast.wf (tRel n :: acc)
n:nat
acc:list term
decl_name:aname
decl_type:term
Γ:list context_decl
IHΓ:forall (n0 : nat) (acc0 : list term), Forall Ast.wf acc0 -> Forall Ast.wf (reln acc0 n0 Γ)
wfacc:Forall Ast.wf acc

Ast.wf (tRel n)
constructor. Qed. Hint Resolve wf_reln : wf.
params:context
pars, s:list term
ty:term
s':list term
ty':term

instantiate_params_subst_spec params pars s ty s' ty' -> Forall wf_decl params -> Ast.wf ty -> Forall Ast.wf pars -> Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
params:context
pars, s:list term
ty:term
s':list term
ty':term

instantiate_params_subst_spec params pars s ty s' ty' -> Forall wf_decl params -> Ast.wf ty -> Forall Ast.wf pars -> Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
params:context
pars, s:list term
ty:term
s':list term
ty':term
ipars:instantiate_params_subst_spec params pars s ty s' ty'

Forall wf_decl params -> Ast.wf ty -> Forall Ast.wf pars -> Forall Ast.wf s -> Forall Ast.wf s' /\ Ast.wf ty'
na:aname
ty:term
params:context
pari:term
pars, s:list term
na':aname
ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (pari :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (pari :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vass na ty :: params)
wfty:Ast.wf (tProd na' ty' pty)
wfpars:Forall Ast.wf (pari :: pars)
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vdef na b ty :: params)
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
na:aname
ty:term
params:context
pari:term
pars, s:list term
na':aname
ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (pari :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (pari :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:wf_decl (vass na ty)
wfparams:Forall wf_decl params
wfty:Ast.wf (tProd na' ty' pty)
wfpars:Forall Ast.wf (pari :: pars)
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vdef na b ty :: params)
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
na:aname
ty:term
params:context
pari:term
pars, s:list term
na':aname
ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (pari :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (pari :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:wf_decl (vass na ty)
wfparams:Forall wf_decl params
wfty:Ast.wf (tProd na' ty' pty)
H0:Ast.wf pari
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vdef na b ty :: params)
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
na:aname
ty:term
params:context
pari:term
pars, s:list term
na':aname
ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (pari :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (pari :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:wf_decl (vass na ty)
wfparams:Forall wf_decl params
wfty1:Ast.wf ty'
wfty2:Ast.wf pty
H0:Ast.wf pari
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vdef na b ty :: params)
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s
Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
wfparams:Forall wf_decl (vdef na b ty :: params)
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:wf_decl (vdef na b ty)
wfparams:Forall wf_decl params
wfty:Ast.wf (tLetIn na' b' ty' pty)
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:wf_decl (vdef na b ty)
wfparams:Forall wf_decl params
wfty1:Ast.wf b'
wfty2:Ast.wf ty'
wfty3:Ast.wf pty
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
na:aname
b, ty:term
params:context
pars, s:list term
na':aname
b', ty', pty:term
s':list term
pty':term
ipars:instantiate_params_subst_spec params pars (subst0 s b :: s) pty s' pty'
IHipars:Forall wf_decl params -> Ast.wf pty -> Forall Ast.wf pars -> Forall Ast.wf (subst0 s b :: s) -> Forall Ast.wf s' /\ Ast.wf pty'
H:Ast.wf b
H0:Ast.wf ty
wfparams:Forall wf_decl params
wfty1:Ast.wf b'
wfty2:Ast.wf ty'
wfty3:Ast.wf pty
wfpars:Forall Ast.wf pars
wfs:Forall Ast.wf s

Forall Ast.wf s' /\ Ast.wf pty'
apply IHipars; auto with wf. Qed.
l:list aname
l':list context_decl

Forall wf_decl l' -> Forall wf_decl (map2 set_binder_name l l')
l:list aname
l':list context_decl

Forall wf_decl l' -> Forall wf_decl (map2 set_binder_name l l')
a:aname
l:list aname
x:context_decl
l0:list context_decl
H:wf_decl x
H0:Forall wf_decl l0
IHForall:forall l1 : list aname, Forall wf_decl (map2 set_binder_name l1 l0)

wf_decl (set_binder_name a x)
a:aname
l:list aname
x:context_decl
l0:list context_decl
H:wf_decl x
H0:Forall wf_decl l0
IHForall:forall l1 : list aname, Forall wf_decl (map2 set_binder_name l1 l0)
Forall wf_decl (map2 set_binder_name l l0)
a:aname
l:list aname
x:context_decl
l0:list context_decl
H:wf_decl x
H0:Forall wf_decl l0
IHForall:forall l1 : list aname, Forall wf_decl (map2 set_binder_name l1 l0)

Forall wf_decl (map2 set_binder_name l l0)
apply IHForall. Qed.
n, k:nat
Γ:list context_decl
d:context_decl

lift_context n k (d :: Γ) = lift_context n k Γ,, lift_decl n (#|Γ| + k) d
n, k:nat
Γ:list context_decl
d:context_decl

lift_context n k (d :: Γ) = lift_context n k Γ,, lift_decl n (#|Γ| + k) d
n, k:nat
Γ:list context_decl
d:context_decl

fold_context_k (shiftf (lift n) k) (d :: Γ) = fold_context_k (shiftf (lift n) k) Γ,, lift_decl n (#|Γ| + k) d
now rewrite fold_context_k_snoc0. Qed. Hint Rewrite lift_context_snoc0 : lift.
n, k:nat
Γ:list context_decl
d:context_decl

lift_context n k (Γ,, d) = lift_context n k Γ,, lift_decl n (#|Γ| + k) d
n, k:nat
Γ:list context_decl
d:context_decl

lift_context n k (Γ,, d) = lift_context n k Γ,, lift_decl n (#|Γ| + k) d
n, k:nat
Γ:list context_decl
d:context_decl

lift_context n k (d :: Γ) = lift_decl n (#|Γ| + k) d :: lift_context n k Γ
apply lift_context_snoc0. Qed. Hint Rewrite lift_context_snoc : lift.
s:list term
k:nat
Γ:list context_decl

Forall wf_decl Γ -> Forall Ast.wf s -> Forall wf_decl (subst_context s k Γ)
s:list term
k:nat
Γ:list context_decl

Forall wf_decl Γ -> Forall Ast.wf s -> Forall wf_decl (subst_context s k Γ)
s:list term
k:nat
Γ:list context_decl
wfΓ:Forall wf_decl Γ

Forall Ast.wf s -> Forall wf_decl (subst_context s k Γ)
s:list term
k:nat

Forall Ast.wf s -> Forall wf_decl (subst_context s k [])
s:list term
k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall s0 : list term, Forall Ast.wf s0 -> Forall wf_decl (subst_context s0 k l)
Forall Ast.wf s -> Forall wf_decl (subst_context s k (x :: l))
s:list term
k:nat

Forall Ast.wf s -> Forall wf_decl (subst_context s k [])
s:list term
k:nat
H:Forall Ast.wf s

Forall wf_decl (subst_context s k [])
constructor.
s:list term
k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall s0 : list term, Forall Ast.wf s0 -> Forall wf_decl (subst_context s0 k l)

Forall Ast.wf s -> Forall wf_decl (subst_context s k (x :: l))
s:list term
k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall s0 : list term, Forall Ast.wf s0 -> Forall wf_decl (subst_context s0 k l)

Forall Ast.wf s -> Forall wf_decl (subst_context s k l,, subst_decl s (#|l| + k) x)
s:list term
k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall s0 : list term, Forall Ast.wf s0 -> Forall wf_decl (subst_context s0 k l)
H0:Forall Ast.wf s

wf_decl (subst_decl s (#|l| + k) x)
s:list term
k:nat
x:context_decl
l:list context_decl
H:match decl_body x with | Some b => Ast.wf b | None => True end
H1:Ast.wf (decl_type x)
wfΓ:Forall wf_decl l
IHwfΓ:forall s0 : list term, Forall Ast.wf s0 -> Forall wf_decl (subst_context s0 k l)
H0:Forall Ast.wf s

wf_decl (subst_decl s (#|l| + k) x)
destruct x as [? [] ?]; constructor; simpl in *; wf. Qed.
n, k:nat
Γ:list context_decl

Forall wf_decl Γ -> Forall wf_decl (lift_context n k Γ)
n, k:nat
Γ:list context_decl

Forall wf_decl Γ -> Forall wf_decl (lift_context n k Γ)
n, k:nat
Γ:list context_decl
wfΓ:Forall wf_decl Γ

Forall wf_decl (lift_context n k Γ)
n, k:nat

Forall wf_decl (lift_context n k [])
n, k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall n0 k0 : nat, Forall wf_decl (lift_context n0 k0 l)
Forall wf_decl (lift_context n k (x :: l))
n, k:nat

Forall wf_decl (lift_context n k [])
n, k:nat

Forall wf_decl (lift_context n k [])
constructor.
n, k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall n0 k0 : nat, Forall wf_decl (lift_context n0 k0 l)

Forall wf_decl (lift_context n k (x :: l))
n, k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall n0 k0 : nat, Forall wf_decl (lift_context n0 k0 l)

Forall wf_decl (lift_context n k l,, lift_decl n (#|l| + k) x)
n, k:nat
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall n0 k0 : nat, Forall wf_decl (lift_context n0 k0 l)

wf_decl (lift_decl n (#|l| + k) x)
n, k:nat
x:context_decl
l:list context_decl
H:match decl_body x with | Some b => Ast.wf b | None => True end
H0:Ast.wf (decl_type x)
wfΓ:Forall wf_decl l
IHwfΓ:forall n0 k0 : nat, Forall wf_decl (lift_context n0 k0 l)

wf_decl (lift_decl n (#|l| + k) x)
destruct x as [? [] ?]; constructor; simpl in *; wf. Qed.
u:Instance.t
Γ:list context_decl

Forall wf_decl Γ -> Forall wf_decl (subst_instance u Γ)
u:Instance.t
Γ:list context_decl

Forall wf_decl Γ -> Forall wf_decl (subst_instance u Γ)
u:Instance.t
x:context_decl
l:list context_decl
H:wf_decl x
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)

wf_decl (map_decl (subst_instance u) x)
u:Instance.t
na:aname
b, ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := Some b; decl_type := ty |}
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)

wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := Some b; decl_type := ty |})
u:Instance.t
na:aname
ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)
wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := None; decl_type := ty |})
u:Instance.t
na:aname
b, ty:term
l:list context_decl
H:match decl_body {| decl_name := na; decl_body := Some b; decl_type := ty |} with | Some b0 => Ast.wf b0 | None => True end
H1:Ast.wf (decl_type {| decl_name := na; decl_body := Some b; decl_type := ty |})
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)

wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := Some b; decl_type := ty |})
u:Instance.t
na:aname
ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)
wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := None; decl_type := ty |})
u:Instance.t
na:aname
ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)

wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := None; decl_type := ty |})
u:Instance.t
na:aname
ty:term
l:list context_decl
H:match decl_body {| decl_name := na; decl_body := None; decl_type := ty |} with | Some b => Ast.wf b | None => True end
H1:Ast.wf (decl_type {| decl_name := na; decl_body := None; decl_type := ty |})
H0:Forall wf_decl l
IHForall:Forall wf_decl (subst_instance u l)

wf_decl (map_decl (subst_instance u) {| decl_name := na; decl_body := None; decl_type := ty |})
now split; auto; apply wf_subst_instance. Qed.
Γ:list context_decl
n:nat

Forall wf_decl Γ -> Forall Ast.wf (extended_subst Γ n)
Γ:list context_decl
n:nat

Forall wf_decl Γ -> Forall Ast.wf (extended_subst Γ n)
n:nat

Forall Ast.wf (extended_subst [] n)
n:nat
x:context_decl
l:list context_decl
H:wf_decl x
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)
Forall Ast.wf (extended_subst (x :: l) n)
n:nat

Forall Ast.wf (extended_subst [] n)
simpl; constructor.
n:nat
x:context_decl
l:list context_decl
H:wf_decl x
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)

Forall Ast.wf (extended_subst (x :: l) n)
n:nat
na:aname
b, ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := Some b; decl_type := ty |}
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)

Ast.wf (subst0 (extended_subst l n) (lift (context_assumptions l + n) #|extended_subst l n| b))
n:nat
na:aname
ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)
Ast.wf (tRel n)
n:nat
na:aname
b, ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := Some b; decl_type := ty |}
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)

Ast.wf (subst0 (extended_subst l n) (lift (context_assumptions l + n) #|extended_subst l n| b))
n:nat
na:aname
b, ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := Some b; decl_type := ty |}
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)

Ast.wf (lift (context_assumptions l + n) #|extended_subst l n| b)
n:nat
na:aname
b, ty:term
l:list context_decl
H:wf_decl {| decl_name := na; decl_body := Some b; decl_type := ty |}
H0:Forall wf_decl l
IHForall:forall n0 : nat, Forall Ast.wf (extended_subst l n0)

Ast.wf b
apply H. Qed.
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname

Forall wf_decl (ind_params mdecl) -> Forall wf_decl (ind_indices idecl) -> Forall Ast.wf params -> Forall wf_decl (case_predicate_context ind mdecl idecl params uinst pctx)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname

Forall wf_decl (ind_params mdecl) -> Forall wf_decl (ind_indices idecl) -> Forall Ast.wf params -> Forall wf_decl (case_predicate_context ind mdecl idecl params uinst pctx)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl (case_predicate_context ind mdecl idecl params uinst pctx)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl (map2 set_binder_name pctx ({| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |} :: subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl)))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl ({| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |} :: subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

wf_decl {| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |}
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

match decl_body {| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |} with | Some b => Ast.wf b | None => True end
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Ast.wf (decl_type {| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |})
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

True
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Ast.wf (decl_type {| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |})
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Ast.wf (decl_type {| decl_name := {| binder_name := nNamed (ind_name idecl); binder_relevance := ind_relevance idecl |}; decl_body := None; decl_type := mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)) |})
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Ast.wf (mkApps (tInd ind uinst) (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl)))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Ast.wf (tInd ind uinst)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall Ast.wf (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall Ast.wf (map (lift0 #|ind_indices idecl|) params ++ to_extended_list (ind_indices idecl))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall Ast.wf (map (lift0 #|ind_indices idecl|) params)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall Ast.wf (to_extended_list (ind_indices idecl))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall Ast.wf (to_extended_list (ind_indices idecl))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl (subst_context params 0 (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl))))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl (subst_instance uinst (expand_lets_ctx (ind_params mdecl) (ind_indices idecl)))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall wf_decl (lift_context (context_assumptions (ind_params mdecl)) (0 + #|ind_params mdecl|) (ind_indices idecl))
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params
Forall Ast.wf (extended_subst (ind_params mdecl) 0)
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
params:list term
uinst:Instance.t
pctx:list aname
wfparams:Forall wf_decl (ind_params mdecl)
wfindty:Forall wf_decl (ind_indices idecl)
wfpars:Forall Ast.wf params

Forall Ast.wf (extended_subst (ind_params mdecl) 0)
now apply wf_extended_subst. Qed.
cf:checker_flags
Σ:global_env

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
cf:checker_flags
Σ:global_env

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
cf:checker_flags
Σ:global_env
Σ':global_env * universes_decl
Γ:context
t:term
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => Ast.wf t0 /\ match T with | Some T0 => Ast.wf T0 | None => True end) Σ'.1
H:Ast.wf t /\ True

∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)
cf:checker_flags
Σ:global_env
Σ':global_env * universes_decl
Γ:context
t:term
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => Ast.wf t0 /\ match T with | Some T0 => Ast.wf T0 | None => True end) Σ'.1
H:Ast.wf t /\ True

Ast.wf t /\ Ast.wf (tSort Universe.lProp)
wf. Qed.
cf:checker_flags
Σ:global_env

Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env

Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
Σ':global_env * universes_decl
Γ:context
t:term
X:on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T : term) => Ast.wf t0 /\ Ast.wf T)) Σ'.1
X0:∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)

Ast.wf t /\ True
destruct X0 as [s ?]; intuition auto. Qed. Hint Resolve on_global_wf_Forall_decls : wf.
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_inductive Σ ind mdecl idecl -> Forall Ast.wf (pparams p) -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_inductive Σ ind mdecl idecl -> Forall Ast.wf (pparams p) -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (map (case_branch_context_gen (pparams p) (puinst p)) (ind_ctors idecl))
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall (fun ctx : list context_decl => Forall wf_decl ctx) (map (case_branch_context_gen (pparams p) (puinst p)) (ind_ctors idecl))
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall (fun x : constructor_body => Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) x)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

forall x : constructor_body, (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) x -> Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) x)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
x:constructor_body
H:(fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) x

Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) x)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
x:constructor_body
H:Forall wf_decl (cstr_args x)

Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) x)
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
x:constructor_body
H:Forall wf_decl (cstr_args x)

Forall wf_decl (subst_context (pparams p) 0 (subst_instance (puinst p) (cstr_args x)))
cf:checker_flags
Σ:global_env
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_inductive Σ ind mdecl idecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
x:constructor_body
H:Forall wf_decl (cstr_args x)

Forall wf_decl (subst_instance (puinst p) (cstr_args x))
now apply wf_subst_instance_context. Qed.
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_constructor Σ ind mdecl idecl cdecl -> Forall Ast.wf (pparams p) -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall wf_decl (case_branch_context p cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> declared_constructor Σ ind mdecl idecl cdecl -> Forall Ast.wf (pparams p) -> Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall wf_decl (case_branch_context p cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall wf_decl (case_branch_context p cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall wf_decl (case_branch_context_gen (pparams p) (puinst p) cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall wf_decl (subst_context (pparams p) 0 (subst_instance (puinst p) (cstr_args cdecl)))
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall wf_decl (subst_instance (puinst p) (cstr_args cdecl))
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
decli:declared_constructor Σ ind mdecl idecl cdecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall wf_decl (cstr_args cdecl)
cf:checker_flags
Σ:global_env
ind:inductive * nat
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
p:predicate term
ong:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
H:declared_inductive Σ ind.1 mdecl idecl
H0:nth_error (ind_ctors idecl) ind.2 = Some cdecl
wfpars:Forall Ast.wf (pparams p)
Hforall:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)

Forall wf_decl (cstr_args cdecl)
now eapply nth_error_forall in Hforall; tea. Qed.
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body

on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl -> Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body

on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl -> Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
oib:on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl

Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
oib:on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:on_constructors (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ mdecl (inductive_ind ind) idecl (ind_indices idecl) (ind_ctors idecl) (ind_cunivs oib)

Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
oib:on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl
h:All2 (on_constructor (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ mdecl (inductive_ind ind) idecl (ind_indices idecl)) (ind_ctors idecl) (ind_cunivs oib)

Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
oib:on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl
x:constructor_body
y:list Universe.t
l:list constructor_body
l':list (list Universe.t)
r:on_constructor (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ mdecl (inductive_ind ind) idecl (ind_indices idecl) x y
h:All2 (on_constructor (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ mdecl (inductive_ind ind) idecl (ind_indices idecl)) l l'
IHh:Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) l

Forall wf_decl (cstr_args x)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body
oib:on_ind_body (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl (inductive_ind ind) idecl
x:constructor_body
y:list Universe.t
l:list constructor_body
l':list (list Universe.t)
cstr_args_length:context_assumptions (cstr_args x) = cstr_arity x
cstr_eq:cstr_type x = it_mkProd_or_LetIn (ind_params mdecl) (it_mkProd_or_LetIn (cstr_args x) (cstr_concl mdecl (inductive_ind ind) idecl x))
on_ctype:on_type (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl)) (cstr_type x)
on_cargs:sorts_local_ctx (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y
on_cindices:TemplateEnvTyping.ctx_inst (fun (Σ0 : global_env_ext) (Γ : context) (t T : term) => lift_typing (fun (_ : global_env_ext) (_ : context) (t0 T0 : term) => Ast.wf t0 /\ Ast.wf T0) Σ0 Γ t (Some T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl,,, cstr_args x) (cstr_indices x) (List.rev (lift_context #|cstr_args x| 0 (ind_indices idecl)))
on_ctype_positive:positive_cstr mdecl (inductive_ind ind) [] (cstr_type x)
on_ctype_variance:forall v : list Variance.t, ind_variance mdecl = Some v -> cstr_respects_variance Σ mdecl v x
h:All2 (on_constructor (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ mdecl (inductive_ind ind) idecl (ind_indices idecl)) l l'
IHh:Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) l

Forall wf_decl (cstr_args x)
Σ:global_env_ext
mdecl:mutual_inductive_body
x:constructor_body
y:list Universe.t
on_cargs:sorts_local_ctx (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y

Forall wf_decl (cstr_args x)
Σ:global_env_ext
mdecl:mutual_inductive_body
x:constructor_body
y:list Universe.t

sorts_local_ctx (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y -> Forall wf_decl (cstr_args x)
Σ:global_env_ext
mdecl:mutual_inductive_body
x:constructor_body

forall y : list Universe.t, sorts_local_ctx (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) (cstr_args x) y -> Forall wf_decl (cstr_args x)
Σ:global_env_ext
mdecl:mutual_inductive_body
x:constructor_body

forall (c : context) (y : list Universe.t), sorts_local_ctx (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) c y -> Forall wf_decl c
induction c as [|[? [] ?] ?]; simpl; destruct y; intuition auto; constructor; try red; simpl; intuition eauto. Qed.
cf:checker_flags
Σ:global_env
Γ:list context_decl
M, N:term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> Forall wf_decl Γ -> Ast.wf M -> red1 Σ Γ M N -> Ast.wf N
cf:checker_flags
Σ:global_env
Γ:list context_decl
M, N:term

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ -> Forall wf_decl Γ -> Ast.wf M -> red1 Σ Γ M N -> Ast.wf N
cf:checker_flags
Σ:global_env
Γ:list context_decl
M, N:term
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
wfΓ:Forall wf_decl Γ
wfM:Ast.wf M
H:red1 Σ Γ M N

Ast.wf N
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
wfM:Ast.wf (tApp (tLambda na t b) (a :: l))

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
wfM:Ast.wf (tLetIn na b t b')
Ast.wf (b' {0 := b})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
wfM:Ast.wf (tRel i)
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)
Ast.wf (lift0 (S i) body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
wfM:Ast.wf (tCase ci p (mkApps (tConstruct (ci_ind ci) c u) args) brs)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
Ast.wf (iota_red (ci_npar ci) args bctx br)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
wfM:Ast.wf (tApp (tFix mfix idx) args)
narg:nat
fn:term
H:unfold_fix mfix idx = Some (narg, fn)
H0:is_constructor narg args = true
Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
wfM:Ast.wf (tCase ip p (mkApps (tCoFix mfix idx) args) brs)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
Ast.wf (tCase ip p (mkApps fn args) brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
wfM:Ast.wf (tProj p (mkApps (tCoFix mfix idx) args))
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
Ast.wf (tProj p (mkApps fn args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
wfM:Ast.wf (tConst c u)
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body
Ast.wf (subst_instance u body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
wfM:Ast.wf (tProj (i, pars, narg) (mkApps (tConstruct i 0 u) args))
arg:term
H:nth_error args (pars + narg) = Some arg
Ast.wf arg
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M, N:term
wfM:Ast.wf (tLambda na M N)
M':term
H:red1 Σ Γ M M'
IHred1:Forall wf_decl Γ -> Ast.wf M -> Ast.wf M'
Ast.wf (tLambda na M' N)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M, N:term
wfM:Ast.wf (tLambda na N M)
M':term
H:red1 Σ (Γ,, vass na N) M M'
IHred1:Forall wf_decl (Γ,, vass na N) -> Ast.wf M -> Ast.wf M'
Ast.wf (tLambda na N M')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
wfM:Ast.wf (tLetIn na b t b')
r:term
H:red1 Σ Γ b r
IHred1:Forall wf_decl Γ -> Ast.wf b -> Ast.wf r
Ast.wf (tLetIn na r t b')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
wfM:Ast.wf (tLetIn na b t b')
r:term
H:red1 Σ Γ t r
IHred1:Forall wf_decl Γ -> Ast.wf t -> Ast.wf r
Ast.wf (tLetIn na b r b')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
wfM:Ast.wf (tLetIn na b t b')
r:term
H:red1 Σ (Γ,, vdef na b t) b' r
IHred1:Forall wf_decl (Γ,, vdef na b t) -> Ast.wf b' -> Ast.wf r
Ast.wf (tLetIn na b t r)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
wfM:Ast.wf (tCase ind {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |} c brs)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
wfM:Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |} c brs)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn' |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
wfM:Ast.wf (tCase ind p c brs)
c':term
H:red1 Σ Γ c c'
IHred1:Forall wf_decl Γ -> Ast.wf c -> Ast.wf c'
Ast.wf (tCase ind p c' brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
wfM:Ast.wf (tCase ind p c brs)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
Ast.wf (tCase ind p c brs')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
c:term
wfM:Ast.wf (tProj p c)
c':term
H:red1 Σ Γ c c'
IHred1:Forall wf_decl Γ -> Ast.wf c -> Ast.wf c'
Ast.wf (tProj p c')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
M2:list term
wfM:Ast.wf (tApp M1 M2)
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
Ast.wf (mkApps N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
wfM:Ast.wf (tApp M1 M2)
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
Ast.wf (tApp M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M1, M2:term
wfM:Ast.wf (tProd na M1 M2)
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
Ast.wf (tProd na N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M2, M1:term
wfM:Ast.wf (tProd na M1 M2)
N2:term
H:red1 Σ (Γ,, vass na M1) M2 N2
IHred1:Forall wf_decl (Γ,, vass na M1) -> Ast.wf M2 -> Ast.wf N2
Ast.wf (tProd na M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l:list term
wfM:Ast.wf (tEvar ev l)
l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
Ast.wf (tEvar ev l')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
k:cast_kind
M2:term
wfM:Ast.wf (tCast M1 k M2)
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
Ast.wf (tCast N1 k M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:term
k:cast_kind
M1:term
wfM:Ast.wf (tCast M1 k M2)
N2:term
H:red1 Σ Γ M2 N2
IHred1:Forall wf_decl Γ -> Ast.wf M2 -> Ast.wf N2
Ast.wf (tCast M1 k N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
k:cast_kind
M2:term
wfM:Ast.wf (tCast M1 k M2)
Ast.wf M1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
wfM:Ast.wf (tFix mfix0 idx)
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
wfM:Ast.wf (tFix mfix0 idx)
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
wfM:Ast.wf (tCoFix mfix0 idx)
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
wfM:Ast.wf (tCoFix mfix0 idx)
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H1:Ast.wf (tLambda na t b)
H2:Forall Ast.wf (a :: l)

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
H:Ast.wf b
H0:Ast.wf t
H1:Ast.wf b'
Ast.wf (b' {0 := b})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)
Ast.wf (lift0 (S i) body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (iota_red (ci_npar ci) args bctx br)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_fix mfix idx = Some (narg, fn)
H0:is_constructor narg args = true
H1:isApp (tFix mfix idx) = false
H2:args <> []
H3:Ast.wf (tFix mfix idx)
H4:Forall Ast.wf args
Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf (mkApps (tCoFix mfix idx) args)
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ip p (mkApps fn args) brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Ast.wf (mkApps (tCoFix mfix idx) args)
Ast.wf (tProj p (mkApps fn args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body
Ast.wf (subst_instance u body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
arg:term
H:nth_error args (pars + narg) = Some arg
H0:Ast.wf (mkApps (tConstruct i 0 u) args)
Ast.wf arg
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M, N, M':term
H:red1 Σ Γ M M'
IHred1:Forall wf_decl Γ -> Ast.wf M -> Ast.wf M'
H0:Ast.wf M
H1:Ast.wf N
Ast.wf (tLambda na M' N)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M, N, M':term
H:red1 Σ (Γ,, vass na N) M M'
IHred1:Forall wf_decl (Γ,, vass na N) -> Ast.wf M -> Ast.wf M'
H0:Ast.wf N
H1:Ast.wf M
Ast.wf (tLambda na N M')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b', r:term
H:red1 Σ Γ b r
IHred1:Forall wf_decl Γ -> Ast.wf b -> Ast.wf r
H0:Ast.wf b
H1:Ast.wf t
H2:Ast.wf b'
Ast.wf (tLetIn na r t b')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b', r:term
H:red1 Σ Γ t r
IHred1:Forall wf_decl Γ -> Ast.wf t -> Ast.wf r
H0:Ast.wf b
H1:Ast.wf t
H2:Ast.wf b'
Ast.wf (tLetIn na b r b')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b', r:term
H:red1 Σ (Γ,, vdef na b t) b' r
IHred1:Forall wf_decl (Γ,, vdef na b t) -> Ast.wf b' -> Ast.wf r
H0:Ast.wf b
H1:Ast.wf t
H2:Ast.wf b'
Ast.wf (tLetIn na b t r)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
H:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H0:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn' |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
c':term
H:red1 Σ Γ c c'
IHred1:Forall wf_decl Γ -> Ast.wf c -> Ast.wf c'
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind p c' brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind p c brs')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
c, c':term
H:red1 Σ Γ c c'
IHred1:Forall wf_decl Γ -> Ast.wf c -> Ast.wf c'
H0:Ast.wf c
Ast.wf (tProj p c')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
M2:list term
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:isApp M1 = false
H1:M2 <> []
H2:Ast.wf M1
H3:Forall Ast.wf M2
Ast.wf (mkApps N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2
Ast.wf (tApp M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M1, M2, N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:Ast.wf M1
H1:Ast.wf M2
Ast.wf (tProd na N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
M2, M1, N2:term
H:red1 Σ (Γ,, vass na M1) M2 N2
IHred1:Forall wf_decl (Γ,, vass na M1) -> Ast.wf M2 -> Ast.wf N2
H0:Ast.wf M1
H1:Ast.wf M2
Ast.wf (tProd na M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l, l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
H:Forall Ast.wf l
Ast.wf (tEvar ev l')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
k:cast_kind
M2, N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:Ast.wf M1
H1:Ast.wf M2
Ast.wf (tCast N1 k M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:term
k:cast_kind
M1, N2:term
H:red1 Σ Γ M2 N2
IHred1:Forall wf_decl Γ -> Ast.wf M2 -> Ast.wf N2
H0:Ast.wf M1
H1:Ast.wf M2
Ast.wf (tCast M1 k N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
k:cast_kind
M2:term
H:Ast.wf M1
H0:Ast.wf M2
Ast.wf M1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H1:Ast.wf (tLambda na t b)
H2:Forall Ast.wf (a :: l)

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
H:Ast.wf b
H0:Ast.wf t
H1:Ast.wf b'
Ast.wf (b' {0 := b})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)
Ast.wf (lift0 (S i) body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (iota_red (ci_npar ci) args bctx br)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_fix mfix idx = Some (narg, fn)
H0:is_constructor narg args = true
H1:isApp (tFix mfix idx) = false
H2:args <> []
H3:Ast.wf (tFix mfix idx)
H4:Forall Ast.wf args
Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf (mkApps (tCoFix mfix idx) args)
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ip p (mkApps fn args) brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Ast.wf (mkApps (tCoFix mfix idx) args)
Ast.wf (tProj p (mkApps fn args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body
Ast.wf (subst_instance u body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
arg:term
H:nth_error args (pars + narg) = Some arg
H0:Ast.wf (mkApps (tConstruct i 0 u) args)
Ast.wf arg
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
H:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H0:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn' |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind p c brs')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
M2:list term
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:isApp M1 = false
H1:M2 <> []
H2:Ast.wf M1
H3:Forall Ast.wf M2
Ast.wf (mkApps N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2
Ast.wf (tApp M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l, l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
H:Forall Ast.wf l
Ast.wf (tEvar ev l')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
k:cast_kind
M2:term
H:Ast.wf M1
H0:Ast.wf M2
Ast.wf M1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H1:Ast.wf (tLambda na t b)
H2:Forall Ast.wf (a :: l)

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
H:Ast.wf b
H0:Ast.wf t
H1:Ast.wf b'
Ast.wf (b' {0 := b})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)
Ast.wf (lift0 (S i) body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (iota_red (ci_npar ci) args bctx br)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_fix mfix idx = Some (narg, fn)
H0:is_constructor narg args = true
H1:isApp (tFix mfix idx) = false
H2:args <> []
H3:Ast.wf (tFix mfix idx)
H4:Forall Ast.wf args
Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf (mkApps (tCoFix mfix idx) args)
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ip p (mkApps fn args) brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Ast.wf (mkApps (tCoFix mfix idx) args)
Ast.wf (tProj p (mkApps fn args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body
Ast.wf (subst_instance u body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
arg:term
H:nth_error args (pars + narg) = Some arg
H0:Ast.wf (mkApps (tConstruct i 0 u) args)
Ast.wf arg
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
H:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H0:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn' |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (tCase ind p c brs')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
M2:list term
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:isApp M1 = false
H1:M2 <> []
H2:Ast.wf M1
H3:Forall Ast.wf M2
Ast.wf (mkApps N1 M2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2
Ast.wf (tApp M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l, l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
H:Forall Ast.wf l
Ast.wf (tEvar ev l')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H1:Ast.wf (tLambda na t b)
H2:Forall Ast.wf (a :: l)

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H2:Forall Ast.wf (a :: l)
H3:Ast.wf t
H4:Ast.wf b

Ast.wf (mkApps (b {0 := a}) l)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
t, b, a:term
l:list term
H:isApp (tLambda na t b) = false
H0:a :: l <> []
H3:Ast.wf t
H4:Ast.wf b
H1:Ast.wf a
H5:Forall Ast.wf l

Ast.wf (mkApps (b {0 := a}) l)
eauto with wf.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
na:aname
b, t, b':term
H:Ast.wf b
H0:Ast.wf t
H1:Ast.wf b'

Ast.wf (b' {0 := b})
auto with wf.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)

Ast.wf (lift0 (S i) body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:option_map decl_body (nth_error Γ i) = Some (Some body)

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
H:match nth_error Γ i with | Some a => Some (decl_body a) | None => None end = Some (Some body)

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:nat
body:term
c:context_decl
Heq:nth_error Γ i = Some c
H:Some (decl_body c) = Some (Some body)

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
i:nat
body:term
c:context_decl
Heq:nth_error Γ i = Some c
H:Some (decl_body c) = Some (Some body)
wfΓ:wf_decl c

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
i:nat
body:term
c:context_decl
Heq:nth_error Γ i = Some c
H:Some (decl_body c) = Some (Some body)
wfΓ:match decl_body c with | Some b => Ast.wf b | None => True end /\ Ast.wf (decl_type c)

Ast.wf body
apply some_inj in H; rewrite H in wfΓ; apply wfΓ.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (iota_red (ci_npar ci) args bctx br)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Ast.wf (mkApps (tConstruct (ci_ind ci) c u) args)
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (subst0 (List.rev (skipn (ci_npar ci) args)) (expand_lets bctx (bbody br)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (subst0 (List.rev (skipn (ci_npar ci) args)) (expand_lets bctx (bbody br)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall Ast.wf (List.rev (skipn (ci_npar ci) args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (expand_lets bctx (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall Ast.wf (skipn (ci_npar ci) args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (expand_lets bctx (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (expand_lets bctx (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (subst0 (extended_subst bctx 0) (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall Ast.wf (extended_subst bctx 0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl bctx
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl (case_branch_context p cdecl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
declared_inductive ?ind ?mdecl idecl
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

declared_inductive Σ ?ind ?mdecl idecl
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (lift (context_assumptions bctx) (0 + #|bctx|) (bbody br))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
c:nat
u:Instance.t
args:list term
p:predicate term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
br:branch term
H:nth_error brs c = Some br
H0:declared_constructor Σ (ci_ind ci, c) mdecl idecl cdecl
bctx:=case_branch_context p cdecl:context
H1:#|skipn (ci_npar ci) args| = context_assumptions bctx
H2:Forall Ast.wf (pparams p)
H3:Ast.wf (preturn p)
H4:Forall Ast.wf args
H5:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (bbody br)
now eapply nth_error_forall in H5; tea.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_fix mfix idx = Some (narg, fn)
H0:is_constructor narg args = true
H1:isApp (tFix mfix idx) = false
H2:args <> []
H3:Ast.wf (tFix mfix idx)
H4:Forall Ast.wf args

Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:Ast.wf fn
H0:is_constructor narg args = true
H1:isApp (tFix mfix idx) = false
H2:args <> []
H3:Ast.wf (tFix mfix idx)
H4:Forall Ast.wf args

Ast.wf (mkApps fn args)
eapply wf_mkApps; auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf (mkApps (tCoFix mfix idx) args)
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (tCase ip p (mkApps fn args) brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
H2:Ast.wf (mkApps (tCoFix mfix idx) args)
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
Hcof:Ast.wf (tCoFix mfix idx)
Hargs:Forall Ast.wf args
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ip:case_info
p:predicate term
mfix:mfixpoint term
idx:nat
args:list term
brs:list (branch term)
narg:nat
fn:term
H:Ast.wf fn
H0:Forall Ast.wf (pparams p)
H1:Ast.wf (preturn p)
Hcof:Ast.wf (tCoFix mfix idx)
Hargs:Forall Ast.wf args
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (mkApps fn args)
apply wf_mkApps; intuition auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Ast.wf (mkApps (tCoFix mfix idx) args)

Ast.wf (tProj p (mkApps fn args))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
H0:Ast.wf (mkApps (tCoFix mfix idx) args)

Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:unfold_cofix mfix idx = Some (narg, fn)
Hcof:Ast.wf (tCoFix mfix idx)
Hargs:Forall Ast.wf args

Ast.wf (mkApps fn args)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
p:projection
mfix:mfixpoint term
idx:nat
args:list term
narg:nat
fn:term
H:Ast.wf fn
Hcof:Ast.wf (tCoFix mfix idx)
Hargs:Forall Ast.wf args

Ast.wf (mkApps fn args)
apply wf_mkApps; intuition auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body

Ast.wf (subst_instance u body)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:declared_constant Σ c decl
H0:cst_body decl = Some body

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H:lookup_env Σ c = Some (ConstantDecl decl)
H0:cst_body decl = Some body

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
decl:constant_body
body:term
H0:cst_body decl = Some body
Σ':global_env * universes_decl
onΣ':on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf:on_global_decl (fun _ : global_env_ext => wf_decl_pred) Σ' c (ConstantDecl decl)

Ast.wf body
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
c:kername
u:Instance.t
cst_type0:term
cst_body0:option term
cst_universes0:universes_decl
body:term
H0:cst_body0 = Some body
Σ':global_env * universes_decl
onΣ':on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ'.1
prf:on_constant_decl (fun _ : global_env_ext => wf_decl_pred) Σ' {| cst_type := cst_type0; cst_body := cst_body0; cst_universes := cst_universes0 |}

Ast.wf body
subst cst_body0; simpl in *; compute in prf; intuition auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
arg:term
H:nth_error args (pars + narg) = Some arg
H0:Ast.wf (mkApps (tConstruct i 0 u) args)

Ast.wf arg
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
i:inductive
pars, narg:nat
args:list term
u:Instance.t
arg:term
H:nth_error args (pars + narg) = Some arg
H0:Forall Ast.wf args

Ast.wf arg
eapply nth_error_forall in H0; eauto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
H:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H0:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
params':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) params params'
H:Forall Ast.wf params
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (tCase ind {| puinst := puinst; pparams := params'; pcontext := pcontext; preturn := preturn |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd, hd':term
tl:list term
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
a:red1 Σ Γ hd hd'
H5:Ast.wf hd'

Forall Ast.wf (pparams {| puinst := puinst; pparams := hd' :: tl; pcontext := pcontext; preturn := preturn |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd:term
tl, tl':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl tl'
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
H:Ast.wf (tCase ind {| puinst := puinst; pparams := tl'; pcontext := pcontext; preturn := preturn |} c brs)
Forall Ast.wf (pparams {| puinst := puinst; pparams := hd :: tl'; pcontext := pcontext; preturn := preturn |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd, hd':term
tl:list term
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
a:red1 Σ Γ hd hd'
H5:Ast.wf hd'

Forall Ast.wf (hd' :: tl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd:term
tl, tl':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl tl'
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
H:Ast.wf (tCase ind {| puinst := puinst; pparams := tl'; pcontext := pcontext; preturn := preturn |} c brs)
Forall Ast.wf (pparams {| puinst := puinst; pparams := hd :: tl'; pcontext := pcontext; preturn := preturn |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd:term
tl, tl':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl tl'
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
H:Ast.wf (tCase ind {| puinst := puinst; pparams := tl'; pcontext := pcontext; preturn := preturn |} c brs)

Forall Ast.wf (pparams {| puinst := puinst; pparams := hd :: tl'; pcontext := pcontext; preturn := preturn |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd:term
tl, tl':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl tl'
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
H:Ast.wf (tCase ind {| puinst := puinst; pparams := tl'; pcontext := pcontext; preturn := preturn |} c brs)

Forall Ast.wf (hd :: tl')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
hd:term
tl, tl':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) tl tl'
H0:Ast.wf preturn
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Ast.wf hd
H4:Forall Ast.wf tl
H:Forall Ast.wf tl'
H5:Ast.wf preturn
H6:Ast.wf c
H7:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall Ast.wf (hd :: tl')
constructor; auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf (pparams {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H1:Ast.wf (Ast.preturn {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn |})
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (tCase ci {| puinst := puinst; pparams := params; pcontext := pcontext; preturn := preturn' |} c brs)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf preturn'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl (case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs
Forall wf_decl (ind_indices idecl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ci:case_info
params:list term
puinst:Instance.t
pcontext:list aname
preturn, c:term
brs:list (branch term)
idecl:one_inductive_body
mdecl:mutual_inductive_body
isdecl:declared_inductive Σ (ci_ind ci) mdecl idecl
preturn':term
H:red1 Σ (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) preturn preturn'
IHred1:Forall wf_decl (Γ,,, case_predicate_context (ci_ind ci) mdecl idecl params puinst pcontext) -> Ast.wf preturn -> Ast.wf preturn'
H0:Forall Ast.wf params
H1:Ast.wf preturn
H2:Ast.wf c
H3:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall wf_decl (ind_indices idecl)
eapply declared_inductive_wf_indices; eauto; wf.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Ast.wf (tCase ind p c brs')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs

Forall (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:Forall Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:Forall (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)

Forall (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
X:OnOne2All (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) (case_branches_contexts idecl p) brs brs'
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)

All (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => (fun (brctx : context) (br br' : branch term) => (red1 Σ (Γ,,, brctx) (bbody br) (bbody br') × (Forall wf_decl (Γ,,, brctx) -> Ast.wf (bbody br) -> Ast.wf (bbody br'))) * (bcontext br = bcontext br')) i x y * (fun x0 : branch term => Ast.wf (bbody x0)) x) (case_branches_contexts idecl p) brs brs'

All (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) (case_branches_contexts idecl p) brs brs'

All (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl) -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) (case_branches_contexts idecl p) brs brs'

Forall (fun ctor : constructor_body => Forall wf_decl (cstr_args ctor)) (ind_ctors idecl)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) (case_branches_contexts idecl p) brs brs'
All (fun x : branch term => Ast.wf (bbody x)) brs'
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
ind:case_info
p:predicate term
c:term
brs:list (branch term)
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ (ci_ind ind) mdecl idecl
brs':list (branch term)
H:All Ast.wf (pparams p)
H0:Ast.wf (preturn p)
H1:Ast.wf c
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) (case_branches_contexts idecl p) brs brs'

All (fun x : branch term => Ast.wf (bbody x)) brs'
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
brs:list (branch term)
idecl:one_inductive_body
brs':list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) brs
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (case_branches_contexts idecl p)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) (case_branches_contexts idecl p) brs brs'

All (fun x : branch term => Ast.wf (bbody x)) brs'
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
hd':branch term
p0:((red1 Σ (Γ,,, b) (bbody hd) (bbody hd') × (Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd'))) × bcontext hd = bcontext hd') * Ast.wf (bbody hd)
e:#|bs| = #|tl|

All (fun x : branch term => Ast.wf (bbody x)) (hd' :: tl)
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
hd':branch term
p0:((red1 Σ (Γ,,, b) (bbody hd) (bbody hd') × (Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd'))) × bcontext hd = bcontext hd') * Ast.wf (bbody hd)
e:#|bs| = #|tl|
H:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl

All (fun x : branch term => Ast.wf (bbody x)) (hd' :: tl)
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
hd':branch term
p0:red1 Σ (Γ,,, b) (bbody hd) (bbody hd') * (Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd'))
e0:bcontext hd = bcontext hd'
w:Ast.wf (bbody hd)
e:#|bs| = #|tl|
H:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl

All (fun x : branch term => Ast.wf (bbody x)) (hd' :: tl)
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
hd':branch term
e0:bcontext hd = bcontext hd'
w:Ast.wf (bbody hd)
e:#|bs| = #|tl|
H:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl
a:red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0:Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd')

Ast.wf (bbody hd')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
hd':branch term
e0:bcontext hd = bcontext hd'
w:Ast.wf (bbody hd)
e:#|bs| = #|tl|
H:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl
a:red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0:Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd')

Forall wf_decl (Γ,,, b)
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H:Forall wf_decl b
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs
hd':branch term
e0:bcontext hd = bcontext hd'
w:Ast.wf (bbody hd)
e:#|bs| = #|tl|
H0:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl
a:red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0:Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd')

Forall wf_decl (Γ,,, b)
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H:Forall wf_decl b
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs
hd':branch term
e0:bcontext hd = bcontext hd'
w:Ast.wf (bbody hd)
e:#|bs| = #|tl|
H0:Ast.wf (bbody hd)
X:All (fun x : branch term => Ast.wf (bbody x)) tl
a:red1 Σ (Γ,,, b) (bbody hd) (bbody hd')
b0:Forall wf_decl (Γ,,, b) -> Ast.wf (bbody hd) -> Ast.wf (bbody hd')

Forall wf_decl Γ
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'
All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
H2:All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
IHX:All (fun x : branch term => Ast.wf (bbody x)) tl -> Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'

All (fun x : branch term => Ast.wf (bbody x)) (hd :: tl')
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
H:Ast.wf (bbody hd)
X0:All (fun x : branch term => Ast.wf (bbody x)) tl
X1:Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'

All (fun x : branch term => Ast.wf (bbody x)) tl'
Σ:global_env
Γ:context
wfΓ:All wf_decl Γ
p:predicate term
idecl:one_inductive_body
hd:branch term
tl:list (branch term)
b:context
bs:list context
H3:Forall (fun ctx : list context_decl => Forall wf_decl ctx) (b :: bs)
tl':list (branch term)
X:OnOne2All (fun (i : context) (x y : branch term) => ((red1 Σ (Γ,,, i) (bbody x) (bbody y) × (Forall wf_decl (Γ,,, i) -> Ast.wf (bbody x) -> Ast.wf (bbody y))) × bcontext x = bcontext y) * Ast.wf (bbody x)) bs tl tl'
H:Ast.wf (bbody hd)
X0:All (fun x : branch term => Ast.wf (bbody x)) tl
X1:Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs -> All (fun x : branch term => Ast.wf (bbody x)) tl'

Forall (fun ctx : list context_decl => Forall wf_decl ctx) bs
now depelim H3.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M1:term
M2:list term
N1:term
H:red1 Σ Γ M1 N1
IHred1:Forall wf_decl Γ -> Ast.wf M1 -> Ast.wf N1
H0:isApp M1 = false
H1:M2 <> []
H2:Ast.wf M1
H3:Forall Ast.wf M2

Ast.wf (mkApps N1 M2)
now eapply wf_mkApps.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2

Ast.wf (tApp M1 N2)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2

N2 <> []
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2
Forall Ast.wf N2
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H:isApp M1 = false
H0:M2 <> []
H1:Ast.wf M1
H2:Forall Ast.wf M2

Forall Ast.wf N2
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
M2:list term
M1:term
N2:list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) M2 N2
H2:Forall Ast.wf M2

Forall Ast.wf N2
induction X; inv H2; constructor; intuition auto; try congruence.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l, l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
H:Forall Ast.wf l

Ast.wf (tEvar ev l')
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
ev:nat
l, l':list term
X:OnOne2 (fun x y : term => red1 Σ Γ x y * (Forall wf_decl Γ -> Ast.wf x -> Ast.wf y)) l l'
H:Forall Ast.wf l

Forall Ast.wf l'
induction X; inv H; constructor; intuition auto.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
induction X; inv H; constructor; intuition auto; congruence.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Ast.wf (tFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H, H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0 -> All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

forall x y : def term, (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) × (dname x, dtype x, rarg x) = (dname y, dtype y, rarg y) -> Ast.wf (dtype x) /\ Ast.wf (dbody x) -> Ast.wf (dtype y) /\ Ast.wf (dbody y)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

forall x y : def term, (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) × (dname x, dtype x, rarg x) = (dname y, dtype y, rarg y) -> Ast.wf (dtype x) /\ Ast.wf (dbody x) -> Ast.wf (dtype y) /\ Ast.wf (dbody y)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) -> Ast.wf (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
e:(dname {| dname := na; dtype := bo; dbody := ty; rarg := ra |}, dtype {| dname := na; dtype := bo; dbody := ty; rarg := ra |}, rarg {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) = (dname {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}, dtype {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}, rarg {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
H:Ast.wf (dtype {| dname := na; dtype := bo; dbody := ty; rarg := ra |})
H0:Ast.wf (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |})

Ast.wf (dtype {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}) /\ Ast.wf (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
e:(na, bo, ra) = (nb, bb, rb)
H:Ast.wf bo
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
e:(na, bo, ra) = (nb, bb, rb)
H:Ast.wf bo
H0:Ast.wf ty
H2:na = nb
H3:bo = bb
H4:ra = rb

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
e:(nb, bb, rb) = (nb, bb, rb)
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Forall wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
Ast.wf ty
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Forall wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
All wf_decl Γ
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (List.rev (mapi (fun (i : nat) (d : def term) => vass (dname d) (lift0 i (dtype d))) mfix0))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (mapi (fun (i : nat) (d : def term) => vass (dname d) (lift0 i (dtype d))) mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Alli (fun (i : nat) (x : def term) => wf_decl (vass (dname x) (lift0 i (dtype x)))) 0 mfix0
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All ?P mfix0
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
forall (n : nat) (x : def term), ?P x -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) x -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> match decl_body (vass (dname x) (lift0 n (dtype x))) with | Some b => Ast.wf b | None => True end /\ Ast.wf (decl_type (vass (dname x) (lift0 n (dtype x))))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> True /\ Ast.wf (lift0 n (dtype x))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (BasicAst.dtype def) /\ Ast.wf (BasicAst.dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
n:nat
dname:aname
dtype, dbody:term
rarg:nat
H1:Ast.wf (BasicAst.dtype {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |}) /\ Ast.wf (BasicAst.dbody {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |})

True /\ Ast.wf (lift0 n (BasicAst.dtype {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |}))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (BasicAst.dtype def) /\ Ast.wf (BasicAst.dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
n:nat
dname:aname
dtype, dbody:term
rarg:nat
H1:Ast.wf dtype /\ Ast.wf dbody

True /\ Ast.wf (lift0 n dtype)
intuition eauto with wf.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ Γ (dtype x) (dtype y) × (Forall wf_decl Γ -> Ast.wf (dtype x) -> Ast.wf (dtype y))) * ((dname x, dbody x, rarg x) = (dname y, dbody y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
induction X; inv H; constructor; intuition auto; congruence.
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Ast.wf (tCoFix mfix1 idx)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:Forall wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H:All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H, H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0 -> All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix1
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
X:OnOne2 (fun x y : def term => (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) * ((dname x, dtype x, rarg x) = (dname y, dtype y, rarg y))) mfix0 mfix1
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

forall x y : def term, (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) × (dname x, dtype x, rarg x) = (dname y, dtype y, rarg y) -> Ast.wf (dtype x) /\ Ast.wf (dbody x) -> Ast.wf (dtype y) /\ Ast.wf (dbody y)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0

forall x y : def term, (red1 Σ (Γ,,, fix_context mfix0) (dbody x) (dbody y) × (Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody x) -> Ast.wf (dbody y))) × (dname x, dtype x, rarg x) = (dname y, dtype y, rarg y) -> Ast.wf (dtype x) /\ Ast.wf (dbody x) -> Ast.wf (dtype y) /\ Ast.wf (dbody y)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) -> Ast.wf (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
e:(dname {| dname := na; dtype := bo; dbody := ty; rarg := ra |}, dtype {| dname := na; dtype := bo; dbody := ty; rarg := ra |}, rarg {| dname := na; dtype := bo; dbody := ty; rarg := ra |}) = (dname {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}, dtype {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}, rarg {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
H:Ast.wf (dtype {| dname := na; dtype := bo; dbody := ty; rarg := ra |})
H0:Ast.wf (dbody {| dname := na; dtype := bo; dbody := ty; rarg := ra |})

Ast.wf (dtype {| dname := nb; dtype := bb; dbody := tb; rarg := rb |}) /\ Ast.wf (dbody {| dname := nb; dtype := bb; dbody := tb; rarg := rb |})
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
e:(na, bo, ra) = (nb, bb, rb)
H:Ast.wf bo
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
na:aname
bo, ty:term
ra:nat
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
e:(na, bo, ra) = (nb, bb, rb)
H:Ast.wf bo
H0:Ast.wf ty
H2:na = nb
H3:bo = bb
H4:ra = rb

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
e:(nb, bb, rb) = (nb, bb, rb)
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Ast.wf bb /\ Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Ast.wf tb
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Forall wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
Ast.wf ty
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Forall wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (Γ,,, fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
All wf_decl Γ
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (fix_context mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (List.rev (mapi (fun (i : nat) (d : def term) => vass (dname d) (lift0 i (dtype d))) mfix0))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All wf_decl (mapi (fun (i : nat) (d : def term) => vass (dname d) (lift0 i (dtype d))) mfix0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

Alli (fun (i : nat) (x : def term) => wf_decl (vass (dname x) (lift0 i (dtype x)))) 0 mfix0
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

All ?P mfix0
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
forall (n : nat) (x : def term), ?P x -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) x -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> wf_decl (vass (dname x) (lift0 n (dtype x)))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> match decl_body (vass (dname x) (lift0 n (dtype x))) with | Some b => Ast.wf b | None => True end /\ Ast.wf (decl_type (vass (dname x) (lift0 n (dtype x))))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty

forall (n : nat) (x : def term), Ast.wf (dtype x) /\ Ast.wf (dbody x) -> True /\ Ast.wf (lift0 n (dtype x))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (BasicAst.dtype def) /\ Ast.wf (BasicAst.dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
n:nat
dname:aname
dtype, dbody:term
rarg:nat
H1:Ast.wf (BasicAst.dtype {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |}) /\ Ast.wf (BasicAst.dbody {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |})

True /\ Ast.wf (lift0 n (BasicAst.dtype {| dname := dname; dtype := dtype; dbody := dbody; rarg := rarg |}))
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
Γ:context
wfΓ:All wf_decl Γ
mfix0:list (def term)
idx:nat
mfix1:list (def term)
H':All (fun def : def term => Ast.wf (BasicAst.dtype def) /\ Ast.wf (BasicAst.dbody def)) mfix0
ty:term
nb:aname
bb, tb:term
rb:nat
r:red1 Σ (Γ,,, fix_context mfix0) ty tb
ih:Forall wf_decl (Γ,,, fix_context mfix0) -> Ast.wf ty -> Ast.wf tb
H:Ast.wf bb
H0:Ast.wf ty
n:nat
dname:aname
dtype, dbody:term
rarg:nat
H1:Ast.wf dtype /\ Ast.wf dbody

True /\ Ast.wf (lift0 n dtype)
intuition eauto with wf. Qed.
mind:kername
bodies:list one_inductive_body
u:Instance.t

Forall Ast.wf (inds mind u bodies)
mind:kername
bodies:list one_inductive_body
u:Instance.t

Forall Ast.wf (inds mind u bodies)
mind:kername
bodies:list one_inductive_body
u:Instance.t

Forall Ast.wf ((fix aux (n : nat) : list term := match n with | 0 => [] | S n0 => tInd {| inductive_mind := mind; inductive_ind := n0 |} u :: aux n0 end) #|bodies|)
mind:kername
bodies:list one_inductive_body
u:Instance.t

forall n : nat, Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)
mind:kername
bodies:list one_inductive_body
u:Instance.t

Forall Ast.wf []
mind:kername
bodies:list one_inductive_body
u:Instance.t
n:nat
IHn:Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)
Forall Ast.wf (tInd {| inductive_mind := mind; inductive_ind := n |} u :: (fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)
mind:kername
bodies:list one_inductive_body
u:Instance.t
n:nat
IHn:Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)

Forall Ast.wf (tInd {| inductive_mind := mind; inductive_ind := n |} u :: (fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)
mind:kername
bodies:list one_inductive_body
u:Instance.t
n:nat
IHn:Forall Ast.wf ((fix aux (n0 : nat) : list term := match n0 with | 0 => [] | S n1 => tInd {| inductive_mind := mind; inductive_ind := n1 |} u :: aux n1 end) n)

Ast.wf (tInd {| inductive_mind := mind; inductive_ind := n |} u)
wf. Qed. Hint Resolve wf_inds : wf.
ind:inductive
npars, p:nat

Forall Ast.wf (projs ind npars p)
ind:inductive
npars, p:nat

Forall Ast.wf (projs ind npars p)
ind:inductive
npars, p:nat

Forall Ast.wf ((fix projs (ind0 : inductive) (npars0 k : nat) {struct k} : list term := match k with | 0 => [] | S k' => tProj (ind0, npars0, k') (tRel 0) :: projs ind0 npars0 k' end) ind npars p)
induction p; constructor; wf. Qed. Ltac specialize_goal := repeat match goal with | H : ?P -> _, H' : ?P |- _ => specialize (H H') end.
n, k:nat
t:term

Ast.wf (lift n k t) -> Ast.wf t
n, k:nat
t:term

Ast.wf (lift n k t) -> Ast.wf t
n, k:nat
t:term
l:list term
IHt:forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0:isApp (lift n k t) = false
H1:map (lift n k) l = [] -> False
H2:Ast.wf (lift n k t)
H3:All (fun x : term => (forall n0 k0 : nat, Ast.wf (lift n0 k0 x) -> Ast.wf x) * Ast.wf (lift n k x)) l

isApp t = false
n, k:nat
t:term
l:list term
IHt:forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0:isApp (lift n k t) = false
H1:map (lift n k) l = [] -> False
H2:Ast.wf (lift n k t)
H3:All (fun x : term => (forall n0 k0 : nat, Ast.wf (lift n0 k0 x) -> Ast.wf x) * Ast.wf (lift n k x)) l
H:l = []
False
n, k:nat
t:term
l:list term
IHt:forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0:isApp (lift n k t) = false
H1:map (lift n k) l = [] -> False
H2:Ast.wf (lift n k t)
H3:All (fun x : term => (forall n0 k0 : nat, Ast.wf (lift n0 k0 x) -> Ast.wf x) * Ast.wf (lift n k x)) l

isApp t = false
n, k:nat
t:term
args, l:list term
IHt:forall n0 k0 : nat, Ast.wf (lift n0 k0 (tApp t args)) -> Ast.wf (tApp t args)
H0:isApp (lift n k (tApp t args)) = false
H1:map (lift n k) l = [] -> False
H2:Ast.wf (lift n k (tApp t args))
H3:All (fun x : term => (forall n0 k0 : nat, Ast.wf (lift n0 k0 x) -> Ast.wf x) * Ast.wf (lift n k x)) l

isApp (tApp t args) = false
discriminate.
n, k:nat
t:term
l:list term
IHt:forall n0 k0 : nat, Ast.wf (lift n0 k0 t) -> Ast.wf t
H0:isApp (lift n k t) = false
H1:map (lift n k) l = [] -> False
H2:Ast.wf (lift n k t)
H3:All (fun x : term => (forall n0 k0 : nat, Ast.wf (lift n0 k0 x) -> Ast.wf x) * Ast.wf (lift n k x)) l
H:l = []

False
destruct l; simpl in *; congruence. Qed.
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body

on_inductive (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl -> Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body

on_inductive (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl -> Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
oib:on_inductive (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (inductive_mind ind) mdecl

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
oib:on_context (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ (ind_params mdecl)

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
oib:TemplateEnvTyping.All_local_env (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ) (ind_params mdecl)

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
decl_name:aname
decl_type:term
c:list context_decl
X:TemplateEnvTyping.All_local_env (lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ) c
X0:∑ s : Universe.t, Ast.wf decl_type /\ Ast.wf (tSort s)
H:Forall wf_decl c

Ast.wf decl_type
destruct X0; intuition auto. Qed.
Γ, Δ:list context_decl

Forall wf_decl Γ -> Forall wf_decl Δ -> Forall wf_decl (smash_context Δ Γ)
Γ, Δ:list context_decl

Forall wf_decl Γ -> Forall wf_decl Δ -> Forall wf_decl (smash_context Δ Γ)
Δ:list context_decl
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall wf_decl match x with | {| decl_body := Some b |} => smash_context (subst_context [b] 0 Δ) l | {| decl_body := None |} => smash_context (Δ ++ [x]) l end
Δ:list context_decl
decl_name:aname
t, decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := Some t; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall wf_decl (smash_context (subst_context [t] 0 Δ) l)
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ
Forall wf_decl (smash_context (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}]) l)
Δ:list context_decl
decl_name:aname
t, decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := Some t; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall wf_decl (subst_context [t] 0 Δ)
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ
Forall wf_decl (smash_context (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}]) l)
Δ:list context_decl
decl_name:aname
t, decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := Some t; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall Ast.wf [t]
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ
Forall wf_decl (smash_context (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}]) l)
Δ:list context_decl
decl_name:aname
t, decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := Some t; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Ast.wf t
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ
Forall wf_decl (smash_context (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}]) l)
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall wf_decl (smash_context (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}]) l)
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

Forall wf_decl (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}])
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

All wf_decl (Δ ++ [{| decl_name := decl_name; decl_body := None; decl_type := decl_type |}])
Δ:list context_decl
decl_name:aname
decl_type:term
l:list context_decl
H:wf_decl {| decl_name := decl_name; decl_body := None; decl_type := decl_type |}
wfΓ:Forall wf_decl l
IHwfΓ:forall Δ0 : list context_decl, Forall wf_decl Δ0 -> Forall wf_decl (smash_context Δ0 l)
wfΔ:Forall wf_decl Δ

All wf_decl Δ
now apply Forall_All in wfΔ. Qed. (* Lemma smash_context_app Γ Δ : smash_context Δ Γ = smash_context [] Γ ++ Δ. Proof. induction Γ in Δ |- *; simpl; auto. destruct a as [? [] ?]; simpl; auto. rewrite IHΓ. rewrite IHΓ. *)
cf:checker_flags

forall (Σ : global_env) (p : projection) (mdecl : mutual_inductive_body) (idecl : one_inductive_body) (pdecl : ident × term), declared_projection Σ p mdecl idecl pdecl -> Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> Ast.wf pdecl.2
cf:checker_flags

forall (Σ : global_env) (p : projection) (mdecl : mutual_inductive_body) (idecl : one_inductive_body) (pdecl : ident × term), declared_projection Σ p mdecl idecl pdecl -> Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ p mdecl idecl pdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hmdecl:declared_minductive Σ (inductive_mind p.1.1) mdecl
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind p.1.1) = Some idecl
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind p.1.1) = Some idecl
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) (InductiveDecl mdecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind p.1.1) = Some idecl
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_inductive (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind p.1.1) = Some idecl
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_inductive (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl
wfpars:Forall wf_decl (ind_params mdecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hidecl:nth_error (ind_bodies mdecl) (inductive_ind p.1.1) = Some idecl
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
Hpdecl:nth_error (ind_projs idecl) p.2 = Some pdecl /\ ind_npars mdecl = p.1.2
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
on_projs:ind_projs idecl <> [] -> match ind_ctors idecl with | [] => False | [o] => on_projections mdecl (inductive_mind p.1.1) (0 + inductive_ind p.1.1) idecl (ind_indices idecl) o | o :: _ :: _ => False end

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
on_projs:match ind_ctors idecl with | [] => False | [o] => on_projections mdecl (inductive_mind p.1.1) (0 + inductive_ind p.1.1) idecl (ind_indices idecl) o | o :: _ :: _ => False end

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs:on_projections mdecl (inductive_mind p.1.1) (0 + inductive_ind p.1.1) idecl (ind_indices idecl) c

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
on_projs:Alli (on_projection mdecl (inductive_mind p.1.1) (0 + inductive_ind p.1.1) c) 0 (ind_projs idecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
on_projs:on_projection mdecl (inductive_mind p.1.1) (0 + inductive_ind p.1.1) c (0 + p.2) pdecl

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
on_projs:match nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S (0 + p.2)) with | Some decl => binder_name (decl_name decl) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := 0 + inductive_ind p.1.1 |} (ind_npars mdecl) (0 + p.2)) (lift 1 (0 + p.2) (decl_type decl))) | None => False end

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
on_projs:match nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S (0 + p.2)) with | Some decl => binder_name (decl_name decl) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := 0 + inductive_ind p.1.1 |} (ind_npars mdecl) (0 + p.2)) (lift 1 (0 + p.2) (decl_type decl))) | None => False end

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
on_projs:match nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) with | Some decl => binder_name (decl_name decl) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type decl))) | None => False end

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H1:Forall (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H1:All (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H1:All (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) (ind_ctors idecl)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H1:All (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) [c]

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
X0:All (fun cs : constructor_body => Forall wf_decl (cstr_args cs)) []

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
on_projs:binder_name (decl_name c0) = nNamed pdecl.1 /\ pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf pdecl.2
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf (subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0))))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Forall Ast.wf (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
Ast.wf (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Forall Ast.wf (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2)
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
Ast.wf (lift 1 p.2 (decl_type c0))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf (lift 1 p.2 (decl_type c0))
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
wfpars:Forall wf_decl (ind_params mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)

Ast.wf (decl_type c0)
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
wfpars:Forall wf_decl (cstr_args c ++ ind_params mdecl)

Ast.wf (decl_type c0)
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
wfpars:Forall wf_decl (smash_context [] (cstr_args c ++ ind_params mdecl))

Ast.wf (decl_type c0)
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
wfpars:Forall wf_decl (cstr_args c ++ ind_params mdecl)
Forall wf_decl []
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
Heq':nth_error (smash_context [] (cstr_args c ++ ind_params mdecl)) (context_assumptions (cstr_args c) - S p.2) = Some c0
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
wfpars:Forall wf_decl (smash_context [] (cstr_args c ++ ind_params mdecl))

Ast.wf (decl_type c0)
cf:checker_flags
Σ:global_env
p:projection
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:Alli (on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl) 0 (ind_bodies mdecl)
Hidecl:on_ind_body (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' (inductive_mind p.1.1) mdecl (0 + inductive_ind p.1.1) idecl
H:nth_error (ind_projs idecl) p.2 = Some pdecl
H0:ind_npars mdecl = p.1.2
c:constructor_body
Heq:ind_ctors idecl = [c]
on_projs_record:#|ind_ctors idecl| = 1
on_projs_noidx:#|ind_indices idecl| = 0
on_projs_elim:ind_kelim idecl = IntoAny
on_projs_all:#|ind_projs idecl| = context_assumptions (cstr_args c)
c0:context_decl
onna:binder_name (decl_name c0) = nNamed pdecl.1
on_projs:pdecl.2 = subst (inds (inductive_mind p.1.1) (TemplateLookup.abstract_instance (ind_universes mdecl)) (ind_bodies mdecl)) (S (ind_npars mdecl)) (subst0 (projs {| inductive_mind := inductive_mind p.1.1; inductive_ind := inductive_ind p.1.1 |} (ind_npars mdecl) p.2) (lift 1 p.2 (decl_type c0)))
H2:Forall wf_decl (cstr_args c)
wfpars:Forall wf_decl (smash_context [] (cstr_args c ++ ind_params mdecl))
Heq':wf_decl c0

Ast.wf (decl_type c0)
apply Heq'. Qed. (* TODO MOVE *) Definition on_option {A} (P : A -> Prop) (o : option A) := match o with | Some x => P x | None => True end.
cf:checker_flags

forall (Σ : global_env) (cst : kername) (decl : constant_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_constant Σ cst decl -> Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags

forall (Σ : global_env) (cst : kername) (decl : constant_body), Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ -> declared_constant Σ cst decl -> Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
h:declared_constant Σ cst decl

Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
h:lookup_env Σ cst = Some (ConstantDecl decl)

Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env ?P Σ'.1
h':on_global_decl ?P Σ' cst (ConstantDecl decl)

Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
h:lookup_env Σ cst = Some (ConstantDecl decl)
on_global_env ?P Σ
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' cst (ConstantDecl decl)

Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
decl:constant_body
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':on_constant_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' decl

Ast.wf (cst_type decl) /\ on_option Ast.wf (cst_body decl)
cf:checker_flags
Σ:global_env
cst:kername
ty, bo:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':on_constant_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' {| cst_type := ty; cst_body := Some bo; cst_universes := cst_universes0 |}

Ast.wf (cst_type {| cst_type := ty; cst_body := Some bo; cst_universes := cst_universes0 |}) /\ on_option Ast.wf (cst_body {| cst_type := ty; cst_body := Some bo; cst_universes := cst_universes0 |})
cf:checker_flags
Σ:global_env
cst:kername
ty:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':on_constant_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' {| cst_type := ty; cst_body := None; cst_universes := cst_universes0 |}
Ast.wf (cst_type {| cst_type := ty; cst_body := None; cst_universes := cst_universes0 |}) /\ on_option Ast.wf (cst_body {| cst_type := ty; cst_body := None; cst_universes := cst_universes0 |})
cf:checker_flags
Σ:global_env
cst:kername
ty, bo:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':Ast.wf bo /\ Ast.wf ty

Ast.wf ty /\ Ast.wf bo
cf:checker_flags
Σ:global_env
cst:kername
ty:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':∑ s : Universe.t, Ast.wf ty /\ Ast.wf (tSort s)
Ast.wf ty /\ True
cf:checker_flags
Σ:global_env
cst:kername
ty, bo:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':Ast.wf bo /\ Ast.wf ty

Ast.wf ty /\ Ast.wf bo
intuition eauto.
cf:checker_flags
Σ:global_env
cst:kername
ty:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
h':∑ s : Universe.t, Ast.wf ty /\ Ast.wf (tSort s)

Ast.wf ty /\ True
cf:checker_flags
Σ:global_env
cst:kername
ty:term
cst_universes0:universes_decl
:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ
Σ':global_env * universes_decl
wΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
x:Universe.t
a:Ast.wf ty /\ Ast.wf (tSort x)

Ast.wf ty /\ True
intuition eauto. Qed.
H:checker_flags
Σ:global_env_ext
Γ:context
wfΓ:wf_local Σ Γ

All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t T : term) (_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T) Σ Γ wfΓ -> forall t : term, Ast.wf t -> Ast.wf (it_mkProd_or_LetIn Γ t)
H:checker_flags
Σ:global_env_ext
Γ:context
wfΓ:wf_local Σ Γ

All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t T : term) (_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T) Σ Γ wfΓ -> forall t : term, Ast.wf t -> Ast.wf (it_mkProd_or_LetIn Γ t)
H:checker_flags
Σ:global_env_ext

forall t : term, Ast.wf t -> Ast.wf t
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t0 T : term) (_ : Σ0;;; Γ0 |- t0 : T) => Ast.wf t0 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)
forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vass na t) t0))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t0 T : term) (_ : Σ0;;; Γ0 |- t0 : T) => Ast.wf t0 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)
forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vdef na b t) t0))
H:checker_flags
Σ:global_env_ext

forall t : term, Ast.wf t -> Ast.wf t
trivial.
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t0 T : term) (_ : Σ0;;; Γ0 |- t0 : T) => Ast.wf t0 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)

forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vass na t) t0))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vass na t) t0))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (mkProd_or_LetIn (vass na t) t0)
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (decl_type (vass na t))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0
Ast.wf t0
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
t:term
all:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
tu:lift_typing typing Σ Γ t None
p:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf t0
assumption.
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t0 T : term) (_ : Σ0;;; Γ0 |- t0 : T) => Ast.wf t0 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ t0)

forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vdef na b t) t0))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (it_mkProd_or_LetIn Γ (mkProd_or_LetIn (vdef na b t) t0))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (mkProd_or_LetIn (vdef na b t) t0)
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf b
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0
Ast.wf (decl_type (vdef na b t))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0
Ast.wf t0
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf (decl_type (vdef na b t))
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0
Ast.wf t0
H:checker_flags
Σ:global_env_ext
Γ:context
na:aname
b, t:term
all:wf_local Σ Γ
tb:Σ;;; Γ |- b : t
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t1 T : term) (_ : Σ0;;; Γ0 |- t1 : T) => Ast.wf t1 /\ Ast.wf T) Σ Γ all
p:Ast.wf b /\ Ast.wf t
tu:lift_typing typing Σ Γ t None
p0:Ast.wf t /\ Ast.wf (tSort tu.π1)
IHX:forall t1 : term, Ast.wf t1 -> Ast.wf (it_mkProd_or_LetIn Γ t1)
t0:term
Ht0:Ast.wf t0

Ast.wf t0
assumption. Qed.
d:context_decl
t:term

wf_decl d -> Ast.wf t -> Ast.wf (mkLambda_or_LetIn d t)
d:context_decl
t:term

wf_decl d -> Ast.wf t -> Ast.wf (mkLambda_or_LetIn d t)
decl_name:aname
t0, decl_type, t:term
H:Ast.wf t0 /\ Ast.wf decl_type
H0:Ast.wf t

Ast.wf (tLetIn decl_name t0 decl_type t)
decl_name:aname
decl_type, t:term
H:True /\ Ast.wf decl_type
H0:Ast.wf t
Ast.wf (tLambda decl_name decl_type t)
decl_name:aname
decl_type, t:term
H:True /\ Ast.wf decl_type
H0:Ast.wf t

Ast.wf (tLambda decl_name decl_type t)
constructor; intuition auto. Qed.
Γ:list context_decl
t:term

Forall wf_decl Γ -> Ast.wf t -> Ast.wf (it_mkLambda_or_LetIn Γ t)
Γ:list context_decl
t:term

Forall wf_decl Γ -> Ast.wf t -> Ast.wf (it_mkLambda_or_LetIn Γ t)
t:term
wft:Ast.wf t

Ast.wf t
t:term
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
wft:Ast.wf t
IHwfΓ:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkLambda_or_LetIn l t0)
Ast.wf (it_mkLambda_or_LetIn l (mkLambda_or_LetIn x t))
t:term
wft:Ast.wf t

Ast.wf t
trivial.
t:term
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
wft:Ast.wf t
IHwfΓ:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkLambda_or_LetIn l t0)

Ast.wf (it_mkLambda_or_LetIn l (mkLambda_or_LetIn x t))
t:term
x:context_decl
l:list context_decl
H:wf_decl x
wfΓ:Forall wf_decl l
wft:Ast.wf t
IHwfΓ:forall t0 : term, Ast.wf t0 -> Ast.wf (it_mkLambda_or_LetIn l t0)

Ast.wf (mkLambda_or_LetIn x t)
now apply wf_Lambda_or_LetIn. Qed.
cf:checker_flags

env_prop (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) (fun (Σ : global_env_ext) (Γ : context) (_ : wf_local Σ Γ) => Forall wf_decl Γ)
cf:checker_flags

env_prop (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) (fun (Σ : global_env_ext) (Γ : context) (_ : wf_local Σ Γ) => Forall wf_decl Γ)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t T : term) (_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T) Σ Γ wfΓ

Forall wf_decl Γ
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
n:nat
decl:context_decl
H:nth_error Γ n = Some decl
H0:Forall wf_decl Γ
Ast.wf (tRel n) /\ Ast.wf (lift0 (S n) (decl_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf (tApp t l) /\ Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (tConst cst u) /\ Ast.wf (subst_instance u (cst_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tInd ind u) /\ Ast.wf (subst_instance u (ind_type idecl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (tConstruct ind i u) /\ Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
H3:Ast.wf (preturn p) /\ Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
H6:Ast.wf c /\ Ast.wf (mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices))
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (tProj p c) /\ Ast.wf (subst0 (c :: List.rev args) (subst_instance u ty))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
types:=fix_context mfix:context
H:is_true (fix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, types |- dbody d : lift0 #|types| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|types| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
types:=fix_context mfix:context
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, types |- dbody d : lift0 #|types| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|types| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (tCoFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t T : term) (_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T) Σ Γ wfΓ

Forall wf_decl Γ
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
X:All_local_env_over typing (fun (Σ0 : global_env_ext) (Γ0 : context) (_ : wf_local Σ0 Γ0) (t T : term) (_ : Σ0;;; Γ0 |- t : T) => Ast.wf t /\ Ast.wf T) Σ Γ wfΓ

TemplateEnvTyping.All_local_env wf_decl_pred Γ
induction X; constructor; auto; red; intuition auto.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
n:nat
decl:context_decl
H:nth_error Γ n = Some decl
H0:Forall wf_decl Γ

Ast.wf (tRel n) /\ Ast.wf (lift0 (S n) (decl_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
n:nat
decl:context_decl
H:nth_error Γ n = Some decl
H0:Forall wf_decl Γ

Ast.wf (lift0 (S n) (decl_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
n:nat
decl:context_decl
H:nth_error Γ n = Some decl
H0:Forall wf_decl Γ

Ast.wf (decl_type decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
n:nat
decl:context_decl
H:nth_error Γ n = Some decl
H0:Forall wf_decl Γ
XX:wf_decl decl

Ast.wf (decl_type decl)
apply XX.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Ast.wf (tApp t l) /\ Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Ast.wf (tApp t l)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Ast.wf t
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Forall Ast.wf l
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Forall Ast.wf l
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
H:Ast.wf t /\ Ast.wf t_ty
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Forall Ast.wf l
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T

Forall Ast.wf []
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl
Forall Ast.wf (hd :: tl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Forall Ast.wf (hd :: tl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf hd
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl
Forall Ast.wf tl
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Forall Ast.wf tl
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf t /\ Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf t
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl
Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Forall Ast.wf [hd]
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl
Ast.wf B
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf B
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T, hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
H0:Ast.wf t
H1:Ast.wf T
H:Ast.wf (tProd na A B)
H2:Ast.wf (tSort s)
H3:Ast.wf hd
H4:Ast.wf A
H6:Ast.wf (B {0 := hd}) -> Forall Ast.wf tl

Ast.wf B
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s
Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
X:Σ;;; Γ |- t : t_ty
H:Ast.wf t /\ Ast.wf t_ty
H0:isApp t = false
H1:l <> []
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t:term
l:list term
t_ty, t':term
H:Ast.wf t /\ Ast.wf t_ty
s:typing_spine Σ Γ t_ty l t'
X0:Forall_typing_spine Σ Γ (fun t0 T : term => Ast.wf t0 /\ Ast.wf T) t_ty l t' s

Ast.wf t'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T

Ast.wf T
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf B'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf B'
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf t /\ Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf t
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf (B {0 := hd})
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Forall Ast.wf [hd]
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'
Ast.wf B
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T:term
H:Ast.wf t /\ Ast.wf T
hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
p:Ast.wf (tProd na A B) /\ Ast.wf (tSort s)
p0:Ast.wf hd /\ Ast.wf A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
IHX0:Ast.wf t /\ Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf B
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
t, T, hd:term
tl:list term
na:aname
A, B:term
s:Universe.t
B':term
tls:typing_spine Σ Γ (B {0 := hd}) tl B'
typrod:Σ;;; Γ |- tProd na A B : tSort s
cumul:Σ;;; Γ |- T <= tProd na A B
ty:Σ;;; Γ |- hd : A
X0:Forall_typing_spine Σ Γ (fun t0 T0 : term => Ast.wf t0 /\ Ast.wf T0) (B {0 := hd}) tl B' tls
H0:Ast.wf t
H1:Ast.wf T
H:Ast.wf (tProd na A B)
H2:Ast.wf (tSort s)
H3:Ast.wf hd
H4:Ast.wf A
H6:Ast.wf (B {0 := hd}) -> Ast.wf B'

Ast.wf B
now inv H.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u

Ast.wf (tConst cst u) /\ Ast.wf (subst_instance u (cst_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u

Ast.wf (tConst cst u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u
Ast.wf (subst_instance u (cst_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u

Ast.wf (subst_instance u (cst_type decl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u

Ast.wf (cst_type decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u

Ast.wf (cst_type decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' cst (ConstantDecl decl)

Ast.wf (cst_type decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
decl:constant_body
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst decl
H1:consistent_instance_ext Σ (cst_universes decl) u
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_constant_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' decl

Ast.wf (cst_type decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
cst_type0:term
cst_universes0:universes_decl
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H1:consistent_instance_ext Σ cst_universes0 u
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
prf:on_type (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ' [] cst_type0

Ast.wf cst_type0
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
cst:kername
u:Instance.t
cst_type0:term
cst_universes0:universes_decl
H:Forall wf_decl Γ
H0:declared_constant Σ.1 cst {| cst_type := cst_type0; cst_body := None; cst_universes := cst_universes0 |}
H1:consistent_instance_ext Σ cst_universes0 u
Σ':global_env * universes_decl
wfΣ':on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ'.1
x:Universe.t
a:Ast.wf cst_type0 /\ Ast.wf (tSort x)

Ast.wf cst_type0
apply a.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (tInd ind u) /\ Ast.wf (subst_instance u (ind_type idecl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (tInd ind u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (subst_instance u (ind_type idecl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (subst_instance u (ind_type idecl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 ind mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (ind_type idecl)
eapply declared_inductive_wf; eauto.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (tConstruct ind i u) /\ Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (tConstruct ind i u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u
Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (type_of_constructor mdecl cdecl (ind, i) u)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (subst0 (inds (inductive_mind (ind, i).1) u (ind_bodies mdecl)) (subst_instance u (cstr_type cdecl)))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (subst_instance u (cstr_type cdecl))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
ind:inductive
i:nat
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
cdecl:constructor_body
isdecl:declared_constructor Σ.1 (ind, i) mdecl idecl cdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:consistent_instance_ext Σ (ind_universes mdecl) u

Ast.wf (cstr_type cdecl)
eapply declared_constructor_wf; eauto.
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
H3:Ast.wf (preturn p) /\ Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
H6:Ast.wf c /\ Ast.wf (mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices))
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
H6:Ast.wf c /\ Ast.wf (mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices))
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
wfapps:Ast.wf (mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices))
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
wfapps:Forall Ast.wf (pparams p ++ indices)
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices

Forall wf_decl predctx
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx
Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices

Forall wf_decl predctx
now apply Forall_app in H4 as [? ?].
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Ast.wf (tCase ci p c brs) /\ Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Ast.wf (mkApps ptm (indices ++ [c]))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Ast.wf ptm
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx
Forall Ast.wf (indices ++ [c])
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p (it_mkLambda_or_LetIn predctx (preturn p)))
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Ast.wf (it_mkLambda_or_LetIn predctx (preturn p))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx
Forall Ast.wf (indices ++ [c])
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p (it_mkLambda_or_LetIn predctx (preturn p)))
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Ast.wf (it_mkLambda_or_LetIn predctx (preturn p))
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx
Forall Ast.wf (indices ++ [c])
cf:checker_flags
Σ:global_env_ext
wfΣ:wf Σ
Γ:context
wfΓ:wf_local Σ Γ
ci:case_info
p:predicate term
c:term
brs:list (branch term)
indices:list term
ps:Universe.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
isdecl:declared_inductive Σ.1 (ci_ind ci) mdecl idecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
H0:ind_npars mdecl = ci_npar ci
H1:#|ind_indices idecl| = #|pcontext p|
H2:context_assumptions (ind_indices idecl) = #|pparams p|
predctx:=case_predicate_context (ci_ind ci) mdecl idecl (pparams p) (puinst p) (pcontext p):context
pret:Σ;;; Γ,,, predctx |- preturn p : tSort ps
wfret:Ast.wf (preturn p)
wps:Ast.wf (tSort ps)
H4:Forall wf_decl (Γ,,, predctx)
H5:is_allowed_elimination Σ ps (ind_kelim idecl)
X0:Σ;;; Γ |- c : mkApps (tInd (ci_ind ci) (puinst p)) (pparams p ++ indices)
wfc:Ast.wf c
H7:isCoFinite (ind_finite mdecl) = false
ptm:=it_mkLambda_or_LetIn predctx (preturn p):term
X1:All2 (fun (br : branch term) (brctxty : list context_decl × term) => (((Forall2 (fun (na : binder_annot name) (decl : context_decl) => eq_binder_annot na (decl_name decl)) (bcontext br) brctxty.1 × Σ;;; Γ,,, brctxty.1 |- bbody br : brctxty.2) × Ast.wf (bbody br) /\ Ast.wf brctxty.2) × Σ;;; Γ,,, brctxty.1 |- brctxty.2 : tSort ps) * (Ast.wf brctxty.2 /\ Ast.wf (tSort ps))) brs (case_branches_types (ci_ind ci) idecl p ptm)
wfp:Forall Ast.wf (pparams p)
wfindices:Forall Ast.wf indices
H3:Forall wf_decl predctx

Forall Ast.wf (indices ++ [c])
apply app_Forall; auto.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term

Ast.wf (tProj p c) /\ Ast.wf (subst0 (c :: List.rev args) (subst_instance u ty))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term

Ast.wf (tProj p c)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst0 (c :: List.rev args) (subst_instance u ty))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term

Ast.wf (subst0 (c :: List.rev args) (subst_instance u ty))
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term

Forall Ast.wf (c :: List.rev args)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Ast.wf (mkApps (tInd p.1.1 u) args)

All Ast.wf (c :: List.rev args)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Ast.wf (mkApps (tInd p.1.1 u) args)

Ast.wf c
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Ast.wf (mkApps (tInd p.1.1 u) args)
All Ast.wf (List.rev args)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Ast.wf (mkApps (tInd p.1.1 u) args)

All Ast.wf (List.rev args)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Forall Ast.wf args

All Ast.wf (List.rev args)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:All wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
H2:Ast.wf c
H3:Forall Ast.wf args

All Ast.wf args
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term
Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl
ty:=pdecl.2:term

Ast.wf (subst_instance u ty)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:declared_projection Σ.1 p mdecl idecl pdecl
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl

Ast.wf (subst_instance u pdecl.2)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
p:projection
c:term
u:Instance.t
mdecl:mutual_inductive_body
idecl:one_inductive_body
pdecl:ident * term
isdecl:Ast.wf pdecl.2
args:list term
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
H:Forall wf_decl Γ
X0:Σ;;; Γ |- c : mkApps (tInd p.1.1 u) args
H0:Ast.wf c /\ Ast.wf (mkApps (tInd p.1.1 u) args)
H1:#|args| = ind_npars mdecl

Ast.wf (subst_instance u pdecl.2)
now eapply wf_subst_instance.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
types:=fix_context mfix:context
H:is_true (fix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, types |- dbody d : lift0 #|types| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|types| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (fix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (tFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (tFix mfix n)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)
Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (tFix mfix n)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:All wf_decl Γ
H2:is_true (wf_fixpoint Σ.1 mfix)
x:def term
a:∑ s : Universe.t, Σ;;; Γ |- dtype x : tSort s × Ast.wf (dtype x) /\ Ast.wf (tSort s)
a0:Σ;;; Γ,,, fix_context mfix |- dbody x : lift0 #|fix_context mfix| (dtype x)
H:Ast.wf (dbody x)
H3:Ast.wf (lift0 #|fix_context mfix| (dtype x))

Ast.wf (dtype x)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:All wf_decl Γ
H2:is_true (wf_fixpoint Σ.1 mfix)
x:def term
x0:Universe.t
p:(Σ;;; Γ |- dtype x : tSort x0) * (Ast.wf (dtype x) /\ Ast.wf (tSort x0))
a0:Σ;;; Γ,,, fix_context mfix |- dbody x : lift0 #|fix_context mfix| (dtype x)
H:Ast.wf (dbody x)
H3:Ast.wf (lift0 #|fix_context mfix| (dtype x))

Ast.wf (dtype x)
intuition.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)

Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_fixpoint Σ.1 mfix)
X:∑ s : Universe.t, Σ;;; Γ |- dtype decl : tSort s × Ast.wf (dtype decl) /\ Ast.wf (tSort s)

Ast.wf (dtype decl)
destruct X as [s ?]; intuition.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
types:=fix_context mfix:context
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, types |- dbody d : lift0 #|types| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|types| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Ast.wf (tCoFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Ast.wf (tCoFix mfix n) /\ Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Ast.wf (tCoFix mfix n)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)
Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Ast.wf (tCoFix mfix n)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Forall (fun def : def term => Ast.wf (dtype def) /\ Ast.wf (dbody def)) mfix
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:All wf_decl Γ
H2:is_true (wf_cofixpoint Σ.1 mfix)
x:def term
a:∑ s : Universe.t, Σ;;; Γ |- dtype x : tSort s × Ast.wf (dtype x) /\ Ast.wf (tSort s)
a0:Σ;;; Γ,,, fix_context mfix |- dbody x : lift0 #|fix_context mfix| (dtype x)
H3:Ast.wf (dbody x)
H4:Ast.wf (lift0 #|fix_context mfix| (dtype x))

Ast.wf (dtype x)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:All wf_decl Γ
H2:is_true (wf_cofixpoint Σ.1 mfix)
x:def term
x0:Universe.t
p:(Σ;;; Γ |- dtype x : tSort x0) * (Ast.wf (dtype x) /\ Ast.wf (tSort x0))
a0:Σ;;; Γ,,, fix_context mfix |- dbody x : lift0 #|fix_context mfix| (dtype x)
H3:Ast.wf (dbody x)
H4:Ast.wf (lift0 #|fix_context mfix| (dtype x))

Ast.wf (dtype x)
intuition.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X:All (fun d : def term => ∑ s : Universe.t, Σ;;; Γ |- dtype d : tSort s × Ast.wf (dtype d) /\ Ast.wf (tSort s)) mfix
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)

Ast.wf (dtype decl)
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ
mfix:list (def term)
n:nat
decl:def term
H:is_true (cofix_guard Σ Γ mfix)
H0:nth_error mfix n = Some decl
H1:Forall wf_decl Γ
X0:All (fun d : def term => (Σ;;; Γ,,, fix_context mfix |- dbody d : lift0 #|fix_context mfix| (dtype d)) * (Ast.wf (dbody d) /\ Ast.wf (lift0 #|fix_context mfix| (dtype d)))) mfix
H2:is_true (wf_cofixpoint Σ.1 mfix)
X:∑ s : Universe.t, Σ;;; Γ |- dtype decl : tSort s × Ast.wf (dtype decl) /\ Ast.wf (tSort s)

Ast.wf (dtype decl)
destruct X as [s ?]; intuition. Qed.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ

Forall wf_decl Γ
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
wfΓ:wf_local Σ Γ

Forall wf_decl Γ
eapply (env_prop_wf_local typing_wf_gen); eauto. Qed. Hint Resolve typing_all_wf_decl : wf.
cf:checker_flags
Σ:global_env
wfΣ:wf Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:wf Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:wf Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:wf Σ
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:wf Σ
X:on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:wf Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t : term) (T : option term) => match T with | Some T0 => Ast.wf t /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s) end) Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t : term) (T : option term) => match T with | Some T0 => Ast.wf t /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s) end) Σ

on_global_env (fun _ : global_env_ext => wf_decl_pred) Σ
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T0 : option term) => match T0 with | Some T1 => Ast.wf t0 /\ Ast.wf T1 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
T:option term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T0 : option term) => match T0 with | Some T1 => Ast.wf t0 /\ Ast.wf T1 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
X1:match T with | Some T0 => Ast.wf t /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s) end

wf_decl_pred Γ t T
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t1 : term) (T : option term) => match T with | Some T0 => Ast.wf t1 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t1 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t, t0:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t1 : term) (T : option term) => match T with | Some T0 => Ast.wf t1 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t1 /\ Ast.wf (tSort s) end) Σ0.1
X1:Ast.wf t /\ Ast.wf t0

wf_decl_pred Γ t (Some t0)
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
X1:∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)
wf_decl_pred Γ t None
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t1 : term) (T : option term) => match T with | Some T0 => Ast.wf t1 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t1 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t, t0:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t1 : term) (T : option term) => match T with | Some T0 => Ast.wf t1 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t1 /\ Ast.wf (tSort s) end) Σ0.1
X1:Ast.wf t /\ Ast.wf t0

Ast.wf t /\ Ast.wf t0
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
X1:∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)
wf_decl_pred Γ t None
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
X1:∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)

wf_decl_pred Γ t None
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
X1:∑ s : Universe.t, Ast.wf t /\ Ast.wf (tSort s)

Ast.wf t /\ True
cf:checker_flags
Σ:global_env
wfΣ:on_global_env (TemplateEnvTyping.lift_typing typing) Σ
X:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ
Σ0:global_env * universes_decl
Γ:context
t:term
X0:on_global_env (fun (_ : global_env_ext) (_ : context) (t0 : term) (T : option term) => match T with | Some T0 => Ast.wf t0 /\ Ast.wf T0 | None => ∑ s : Universe.t, Ast.wf t0 /\ Ast.wf (tSort s) end) Σ0.1
x:Universe.t
a:Ast.wf t
wfs:Ast.wf (tSort x)

Ast.wf t /\ True
split; auto. Qed.
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
t, T:term

Σ;;; Γ |- t : T -> Ast.wf t /\ Ast.wf T
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
t, T:term

Σ;;; Γ |- t : T -> Ast.wf t /\ Ast.wf T
cf:checker_flags
Σ:global_env * universes_decl
wfΣ:wf Σ.1
Γ:context
t, T:term
X:Σ;;; Γ |- t : T

Ast.wf t /\ Ast.wf T
eapply typing_wf_gen in X; intuition eauto with wf. Qed.

forall (params : context) (args s : list term) (t : term) (ctx : list term) (t' : term), Ast.wf t -> instantiate_params_subst params args s t = Some (ctx, t') -> Ast.wf t'

forall (params : context) (args s : list term) (t : term) (ctx : list term) (t' : term), Ast.wf t -> instantiate_params_subst params args s t = Some (ctx, t') -> Ast.wf t'
params:context
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst params args s t = Some (ctx, t')

Ast.wf t'
params:context

forall (args s : list term) (t : term) (ctx : list term) (t' : term), Ast.wf t -> instantiate_params_subst params args s t = Some (ctx, t') -> Ast.wf t'
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst [] args s t = Some (ctx, t')

Ast.wf t'
a:context_decl
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst (a :: params) args s t = Some (ctx, t')
Ast.wf t'
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst [] args s t = Some (ctx, t')

Ast.wf t'
s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst [] [] s t = Some (ctx, t')

Ast.wf t'
s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:Some (s, t) = Some (ctx, t')

Ast.wf t'
s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:Some (s, t) = Some (ctx, t')
H0:s = ctx
H1:t = t'

Ast.wf t'
ctx:list term
t':term
e:Some (ctx, t') = Some (ctx, t')
h:Ast.wf t'

Ast.wf t'
assumption.
a:context_decl
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst (a :: params) args s t = Some (ctx, t')

Ast.wf t'
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params) args s t = Some (ctx, t')

Ast.wf t'
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst ({| decl_name := na; decl_body := None; decl_type := ty |} :: params) args s t = Some (ctx, t')
Ast.wf t'
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params) args s t = Some (ctx, t')

Ast.wf t'
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:match t with | tLetIn _ _ _ b' => instantiate_params_subst params args (subst0 s bo :: s) b' | _ => None end = Some (ctx, t')

Ast.wf t'
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Ast.wf t -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
h:Ast.wf (tLetIn na0 t1 t2 t3)
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')

Ast.wf t'
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Ast.wf t -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
h:Ast.wf (tLetIn na0 t1 t2 t3)
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')

Ast.wf t3
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Ast.wf t -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
H2:Ast.wf t1
H4:Ast.wf t2
H5:Ast.wf t3

Ast.wf t3
assumption.
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:instantiate_params_subst ({| decl_name := na; decl_body := None; decl_type := ty |} :: params) args s t = Some (ctx, t')

Ast.wf t'
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
t:term
ctx:list term
t':term
h:Ast.wf t
e:match t with | tProd _ _ B => match args with | [] => None | hd :: tl => instantiate_params_subst params tl (hd :: s) B end | _ => None end = Some (ctx, t')

Ast.wf t'
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Ast.wf t -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Ast.wf t'0
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
h:Ast.wf (tProd na0 t1 t2)
e:match args with | [] => None | hd :: tl => instantiate_params_subst params tl (hd :: s) t2 end = Some (ctx, t')

Ast.wf t'
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
h:Ast.wf (tProd na0 t1 t2)
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')

Ast.wf t'
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
h:Ast.wf (tProd na0 t1 t2)
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')

Ast.wf t2
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Ast.wf t0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Ast.wf t'0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')
H1:Ast.wf t1
H3:Ast.wf t2

Ast.wf t2
assumption. Qed.

forall (params : list context_decl) (args s : list term) (t : term) (ctx : list term) (t' : term), Forall Ast.wf args -> Forall wf_decl params -> Forall Ast.wf s -> instantiate_params_subst params args s t = Some (ctx, t') -> Forall Ast.wf ctx

forall (params : list context_decl) (args s : list term) (t : term) (ctx : list term) (t' : term), Forall Ast.wf args -> Forall wf_decl params -> Forall Ast.wf s -> instantiate_params_subst params args s t = Some (ctx, t') -> Forall Ast.wf ctx
params:list context_decl
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl params
hx:Forall Ast.wf s
e:instantiate_params_subst params args s t = Some (ctx, t')

Forall Ast.wf ctx
params:list context_decl

forall (args s : list term) (t : term) (ctx : list term) (t' : term), Forall Ast.wf args -> Forall wf_decl params -> Forall Ast.wf s -> instantiate_params_subst params args s t = Some (ctx, t') -> Forall Ast.wf ctx
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl []
hx:Forall Ast.wf s
e:instantiate_params_subst [] args s t = Some (ctx, t')

Forall Ast.wf ctx
a:context_decl
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl (a :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst (a :: params) args s t = Some (ctx, t')
Forall Ast.wf ctx
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl []
hx:Forall Ast.wf s
e:instantiate_params_subst [] args s t = Some (ctx, t')

Forall Ast.wf ctx
s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf []
hp:Forall wf_decl []
hx:Forall Ast.wf s
e:instantiate_params_subst [] [] s t = Some (ctx, t')

Forall Ast.wf ctx
s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf []
hp:Forall wf_decl []
hx:Forall Ast.wf s
e:Some (s, t) = Some (ctx, t')

Forall Ast.wf ctx
s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf []
hp:Forall wf_decl []
hx:Forall Ast.wf s
e:Some (s, t) = Some (ctx, t')
H0:s = ctx
H1:t = t'

Forall Ast.wf ctx
ctx:list term
t':term
ha:Forall Ast.wf []
hp:Forall wf_decl []
e:Some (ctx, t') = Some (ctx, t')
hx:Forall Ast.wf ctx

Forall Ast.wf ctx
assumption.
a:context_decl
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl (a :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst (a :: params) args s t = Some (ctx, t')

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params) args s t = Some (ctx, t')

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst ({| decl_name := na; decl_body := None; decl_type := ty |} :: params) args s t = Some (ctx, t')
Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params) args s t = Some (ctx, t')

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:match t with | tLetIn _ _ _ b' => instantiate_params_subst params args (subst0 s bo :: s) b' | _ => None end = Some (ctx, t')

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := Some bo; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
H1:wf_decl {| decl_name := na; decl_body := Some bo; decl_type := ty |}
H2:Forall wf_decl params

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
h1:match decl_body {| decl_name := na; decl_body := Some bo; decl_type := ty |} with | Some b => Ast.wf b | None => True end
h2:Ast.wf (decl_type {| decl_name := na; decl_body := Some bo; decl_type := ty |})
H2:Forall wf_decl params

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
h1:Ast.wf bo
h2:Ast.wf ty
H2:Forall wf_decl params

Forall Ast.wf ctx
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
h1:Ast.wf bo
h2:Ast.wf ty
H2:Forall wf_decl params

Forall Ast.wf (subst0 s bo :: s)
na:aname
bo, ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2, t3:term
ctx:list term
t':term
ha:Forall Ast.wf args
hx:Forall Ast.wf s
e:instantiate_params_subst params args (subst0 s bo :: s) t3 = Some (ctx, t')
h1:Ast.wf bo
h2:Ast.wf ty
H2:Forall wf_decl params

Ast.wf (subst0 s bo)
eapply wf_subst ; assumption.
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst ({| decl_name := na; decl_body := None; decl_type := ty |} :: params) args s t = Some (ctx, t')

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
t:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:match t with | tProd _ _ B => match args with | [] => None | hd :: tl => instantiate_params_subst params tl (hd :: s) B end | _ => None end = Some (ctx, t')

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t = Some (ctx0, t'0) -> Forall Ast.wf ctx0
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
ha:Forall Ast.wf args
hp:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:match args with | [] => None | hd :: tl => instantiate_params_subst params tl (hd :: s) t2 end = Some (ctx, t')

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
ha:Forall Ast.wf (t :: args)
hp:Forall wf_decl ({| decl_name := na; decl_body := None; decl_type := ty |} :: params)
hx:Forall Ast.wf s
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
ha:Forall Ast.wf (t :: args)
hx:Forall Ast.wf s
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')
H1:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H2:Forall wf_decl params

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
ha:Forall Ast.wf (t :: args)
hx:Forall Ast.wf s
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')
H1:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H2:Forall wf_decl params

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
hx:Forall Ast.wf s
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')
H1:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H2:Forall wf_decl params
H3:Ast.wf t
H4:Forall Ast.wf args

Forall Ast.wf ctx
na:aname
ty:term
params:list context_decl
IHparams:forall (args0 s0 : list term) (t0 : term) (ctx0 : list term) (t'0 : term), Forall Ast.wf args0 -> Forall wf_decl params -> Forall Ast.wf s0 -> instantiate_params_subst params args0 s0 t0 = Some (ctx0, t'0) -> Forall Ast.wf ctx0
t:term
args, s:list term
na0:aname
t1, t2:term
ctx:list term
t':term
hx:Forall Ast.wf s
e:instantiate_params_subst params args (t :: s) t2 = Some (ctx, t')
H1:wf_decl {| decl_name := na; decl_body := None; decl_type := ty |}
H2:Forall wf_decl params
H3:Ast.wf t
H4:Forall Ast.wf args

Forall Ast.wf (t :: s)
constructor ; assumption. Qed. (* Lemma wf_instantiate_params : forall params args t t', Forall wf_decl params -> Forall Ast.wf args -> Ast.wf t -> instantiate_params params args t = Some t' -> Ast.wf t'. Proof. intros params args t t' hparamas hargs ht e. unfold instantiate_params in e. revert e. case_eq (instantiate_params_subst (List.rev params) args [] t) ; try discriminate. intros [ctx u] eq e. inversion e. subst. clear e. apply wf_instantiate_params_subst_term in eq as h1 ; trivial. apply wf_instantiate_params_subst_ctx in eq as h2 ; trivial. - eapply wf_subst ; trivial. - eapply rev_Forall. assumption. Qed. *) Record wf_inductive_body idecl := { wf_ind_type : Ast.wf (ind_type idecl); wf_ind_ctors : Forall (fun cdecl => Ast.wf (cstr_type cdecl)) (ind_ctors idecl); wf_ind_projs : Forall (fun pdecl => Ast.wf pdecl.2) (ind_projs idecl) }.
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body

wf Σ.1 -> declared_minductive Σ mind mdecl -> Alli (fun (i : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl) 0 (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body

wf Σ.1 -> declared_minductive Σ mind mdecl -> Alli (fun (i : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl) 0 (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
X:wf Σ.1
H:declared_minductive Σ mind mdecl

forall (i : nat) (x : one_inductive_body), nth_error (ind_bodies mdecl) i = Some x -> declared_inductive Σ {| inductive_mind := mind; inductive_ind := 0 + i |} mdecl x
intros; split; auto. Qed.
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body

wf Σ.1 -> declared_inductive Σ ind mdecl idecl -> Alli (fun (i : nat) (decl : constructor_body) => declared_constructor Σ (ind, i) mdecl idecl decl) 0 (ind_ctors idecl) × Alli (fun (i : nat) (decl : ident × term) => declared_projection Σ (ind, ind_npars mdecl, i) mdecl idecl decl) 0 (ind_projs idecl)
cf:checker_flags
Σ:global_env_ext
ind:inductive
mdecl:mutual_inductive_body
idecl:one_inductive_body

wf Σ.1 -> declared_inductive Σ ind mdecl idecl -> Alli (fun (i : nat) (decl : constructor_body) => declared_constructor Σ (ind, i) mdecl idecl decl) 0 (ind_ctors idecl) × Alli (fun (i : nat) (decl : ident × term) => declared_projection Σ (ind, ind_npars mdecl, i) mdecl idecl decl) 0 (ind_projs idecl)
intros; split; eapply forall_nth_error_Alli; intros; split; auto. Qed.
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body

wf Σ.1 -> declared_minductive Σ mind mdecl -> Forall wf_decl (ind_params mdecl) /\ Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body

wf Σ.1 -> declared_minductive Σ mind mdecl -> Forall wf_decl (ind_params mdecl) /\ Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl

Forall wf_decl (ind_params mdecl) /\ Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1

Forall wf_decl (ind_params mdecl) /\ Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
x:global_env * universes_decl
x0:on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) x.1
o:on_global_decl (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) x mind (InductiveDecl mdecl)

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
x:global_env * universes_decl
x0:on_global_env (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) x.1
o:on_inductive (TemplateEnvTyping.lift_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T)) x mind mdecl

Forall wf_decl (ind_params mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1

Forall wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1

All wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl) 0 (ind_bodies mdecl)

All wf_inductive_body (ind_bodies mdecl)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl) 0 (ind_bodies mdecl)

forall (n : nat) (x : one_inductive_body), (fun (i : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl decl) n x -> wf_inductive_body x
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:(fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) i oib

wf_inductive_body oib
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib

wf_inductive_body oib
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

wf_inductive_body oib
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

Ast.wf (ind_type oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun cdecl : constructor_body => Ast.wf (cstr_type cdecl)) (ind_ctors oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

Forall (fun cdecl : constructor_body => Ast.wf (cstr_type cdecl)) (ind_ctors oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

forall (n : nat) (x : constructor_body), (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) n x -> Ast.wf (cstr_type x)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
n:nat
x:constructor_body
H0:declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, n) mdecl oib x

Ast.wf (cstr_type x)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
n:nat
x:constructor_body
H0:declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, n) mdecl oib x

list Level.t
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

Forall (fun pdecl : ident × term => Ast.wf pdecl.2) (ind_projs oib)
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)

forall (n : nat) (x : ident × term), (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) n x -> Ast.wf x.2
cf:checker_flags
Σ:global_env_ext
mind:kername
mdecl:mutual_inductive_body
wfΣ:wf Σ.1
declm:declared_minductive Σ mind mdecl
X:Forall_decls_typing (fun (_ : global_env_ext) (_ : context) (t T : term) => Ast.wf t /\ Ast.wf T) Σ.1
decli:Alli (fun (i0 : nat) (decl : one_inductive_body) => declared_inductive Σ {| inductive_mind := mind; inductive_ind := i0 |} mdecl decl) 0 (ind_bodies mdecl)
i:nat
oib:one_inductive_body
H:declared_inductive Σ {| inductive_mind := mind; inductive_ind := i |} mdecl oib
declc:Alli (fun (i0 : nat) (decl : constructor_body) => declared_constructor Σ ({| inductive_mind := mind; inductive_ind := i |}, i0) mdecl oib decl) 0 (ind_ctors oib)
declp:Alli (fun (i0 : nat) (decl : ident × term) => declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, i0) mdecl oib decl) 0 (ind_projs oib)
n:nat
x:ident * term
H0:declared_projection Σ ({| inductive_mind := mind; inductive_ind := i |}, ind_npars mdecl, n) mdecl oib x

Ast.wf x.2
eapply declared_projection_wf in H0; eauto. Qed.
t, u:term

Ast.wf (mkApp t u) -> exists (f : term) (args : list term), mkApp t u = tApp f args /\ ~~ isApp f
t, u:term

Ast.wf (mkApp t u) -> exists (f : term) (args : list term), mkApp t u = tApp f args /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f

Ast.wf (tApp t (args ++ [u])) -> exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
wf:Ast.wf (tApp t (args ++ [u]))

exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf (args ++ [u])

exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
wfu:Forall Ast.wf [u]

exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []

exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:Ast.wf (mkApp t u) -> exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []

Ast.wf (mkApp t u)
t:term
args:list term
u:term
IHt:exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []
exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u:term
IHt:exists (f : term) (args0 : list term), mkApp t u = tApp f args0 /\ ~~ isApp f
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []

exists (f : term) (args0 : list term), tApp t (args ++ [u]) = tApp f args0 /\ ~~ isApp f
t:term
args:list term
u, f:term
ar:list term
eqf:mkApp t u = tApp f ar
isap:is_true (~~ isApp f)
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []

exists (f0 : term) (args0 : list term), tApp t (args ++ [u]) = tApp f0 args0 /\ ~~ isApp f0
t:term
args:list term
u, f:term
ar:list term
eqf:mkApp t u = tApp f ar
isap:is_true (~~ isApp f)
appt:isApp t = false
wft:Ast.wf t
wfargs:Forall Ast.wf args
H:Ast.wf u
wfu:Forall Ast.wf []

is_true (~~ isApp t)
rewrite appt //. Qed.
f, u:term

(decompose_app (mkApp f u)).2 <> []
f, u:term

(decompose_app (mkApp f u)).2 <> []
f:term
args:list term
u:term
IHf:(decompose_app (mkApp f u)).2 <> []

args ++ [u] <> []
destruct args; simpl; congruence. Qed.
f, u, f':term
u':list term

~~ isApp f' -> mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'
f, u, f':term
u':list term

~~ isApp f' -> mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'
f, u, f':term
u':list term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' u'

mkApps f [u] = mkApps f' u'
f, u, f':term
u':list term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' u'

mkApp (mkApps f []) u = mkApps f' u'
f, u, f':term
u':list term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' u'

mkApp f u = mkApps f' u'
f, u, f':term
u':list term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' u'

tApp f' u' = mkApps f' u'
f, u, f':term
u':list term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' u'

is_true (~~ is_empty u')
f, u, f':term
H:is_true (~~ isApp f')
H0:mkApp f u = tApp f' []

is_true (~~ is_empty [])
f, u, f':term
H:is_true (~~ isApp f')
H0:decompose_app (mkApp f u) = decompose_app (tApp f' [])

is_true (~~ is_empty [])
f, u, f':term
H:is_true (~~ isApp f')
H0:decompose_app (mkApp f u) = (f', [])

is_true (~~ is_empty [])
f, u, f':term
H:is_true (~~ isApp f')
H0:decompose_app (mkApp f u) = (f', [])
H1:(decompose_app (mkApp f u)).2 <> []

is_true (~~ is_empty [])
f, u, f':term
H:is_true (~~ isApp f')
H0:decompose_app (mkApp f u) = (f', [])
H1:[] <> []

is_true (~~ is_empty [])
congruence. Qed.
x, y:term

Ast.wf x -> Ast.wf y -> decompose_app x = decompose_app y -> x = y
x, y:term

Ast.wf x -> Ast.wf y -> decompose_app x = decompose_app y -> x = y
x:term
wfx:Ast.wf x

forall y : term, Ast.wf y -> decompose_app x = decompose_app y -> x = y
induction wfx using term_wf_forall_list_ind; intros [] wfy; eapply wf_inv in wfy; simpl in wfy; simpl; intros [= ?]; try intuition congruence. Qed.
t, u:term

∑ (f : term) (args : list term), mkApp t u = tApp f args
t, u:term

∑ (f : term) (args : list term), mkApp t u = tApp f args
induction t; simpl; try solve [eexists _, _; reflexivity]. Qed.
t:term

Ast.wf t -> forall (f : term) (l : list term), decompose_app t = (f, l) -> strip_casts t = mkApps (strip_casts f) (map strip_casts l)
t:term

Ast.wf t -> forall (f : term) (l : list term), decompose_app t = (f, l) -> strip_casts t = mkApps (strip_casts f) (map strip_casts l)
t:term
wf:Ast.wf t

forall (f : term) (l : list term), decompose_app t = (f, l) -> strip_casts t = mkApps (strip_casts f) (map strip_casts l)
t:term
H:isApp t = false
wf:Ast.wf t
l:list term
H0:l = [] -> False
H2:All (fun x : term => Ast.wf x * (forall (f0 : term) (l1 : list term), decompose_app x = (f0, l1) -> strip_casts x = mkApps (strip_casts f0) (map strip_casts l1))) l
IHwf:forall (f0 : term) (l1 : list term), decompose_app t = (f0, l1) -> strip_casts t = mkApps (strip_casts f0) (map strip_casts l1)
f:term
l0:list term
H3:(t, l) = (f, l0)

strip_casts t = strip_casts f
t:term
H:isApp t = false
wf:Ast.wf t
l:list term
H0:l = [] -> False
H2:All (fun x : term => Ast.wf x * (forall (f0 : term) (l1 : list term), decompose_app x = (f0, l1) -> strip_casts x = mkApps (strip_casts f0) (map strip_casts l1))) l
IHwf:forall (f0 : term) (l1 : list term), decompose_app t = (f0, l1) -> strip_casts t = mkApps (strip_casts f0) (map strip_casts l1)
f:term
l0:list term
H3:(t, l) = (f, l0)
map strip_casts l = map strip_casts l0
t:term
H:isApp t = false
wf:Ast.wf t
l:list term
H0:l = [] -> False
H2:All (fun x : term => Ast.wf x * (forall (f0 : term) (l1 : list term), decompose_app x = (f0, l1) -> strip_casts x = mkApps (strip_casts f0) (map strip_casts l1))) l
IHwf:forall (f0 : term) (l1 : list term), decompose_app t = (f0, l1) -> strip_casts t = mkApps (strip_casts f0) (map strip_casts l1)
f:term
l0:list term
H3:(t, l) = (f, l0)

strip_casts t = strip_casts f
now noconf H3.
t:term
H:isApp t = false
wf:Ast.wf t
l:list term
H0:l = [] -> False
H2:All (fun x : term => Ast.wf x * (forall (f0 : term) (l1 : list term), decompose_app x = (f0, l1) -> strip_casts x = mkApps (strip_casts f0) (map strip_casts l1))) l
IHwf:forall (f0 : term) (l1 : list term), decompose_app t = (f0, l1) -> strip_casts t = mkApps (strip_casts f0) (map strip_casts l1)
f:term
l0:list term
H3:(t, l) = (f, l0)

map strip_casts l = map strip_casts l0
now noconf H3. Qed.
f:term
args:list term

~~ isApp f -> ~~ is_empty args -> tApp f args = mkApps f args
f:term
args:list term

~~ isApp f -> ~~ is_empty args -> tApp f args = mkApps f args
f:term
args:list term
H:is_true (~~ isApp f)
H0:is_true (~~ is_empty args)

tApp f args = mkApps f args
destruct args, f; try discriminate; auto. Qed.
f:term
u:list term

~~ isApp f -> Ast.wf f -> Forall Ast.wf u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
u:list term

~~ isApp f -> Ast.wf f -> Forall Ast.wf u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
u:list term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf u

strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf []

strip_casts (mkApps f []) = mkApps (strip_casts f) (map strip_casts [])
f, t:term
u:list term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf (t :: u)
strip_casts (mkApps f (t :: u)) = mkApps (strip_casts f) (map strip_casts (t :: u))
f:term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf []

strip_casts f = strip_casts f
f, t:term
u:list term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf (t :: u)
strip_casts (mkApps f (t :: u)) = mkApps (strip_casts f) (map strip_casts (t :: u))
f, t:term
u:list term
nisapp:is_true (~~ isApp f)
wf:Ast.wf f
wf':Forall Ast.wf (t :: u)

strip_casts (mkApps f (t :: u)) = mkApps (strip_casts f) (map strip_casts (t :: u))
rewrite -(mkApps_tApp f (t :: u)) //. Qed.
f, u:term

mkApp f u = mkApps f [u]
f, u:term

mkApp f u = mkApps f [u]
reflexivity. Qed.
f:term
l:list term
hd:term
args:list term

Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term

Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = true

Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
Heq:isApp f = true

forall (l args : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ f = mkApps hd (firstn n args0)

forall (l args0 : list term) (hd : term), Ast.wf (tApp f args) -> decompose_app (mkApps (tApp f args) l) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
H:Ast.wf (tApp f args)
H0:decompose_app (mkApps (tApp f args) l) = (hd, args0)

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
H:Ast.wf (tApp f args)
H0:decompose_app (mkApps (tApp f args) l) = (hd, args0)

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
H0:decompose_app (mkApps (tApp f args) l) = (hd, args0)
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

is_true (~~ is_empty args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
H0:decompose_app (mkApps (mkApps f args) l) = (hd, args0)
∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
H0:decompose_app (mkApps (mkApps f args) l) = (hd, args0)

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
H0:decompose_app (mkApps f (args ++ l)) = (hd, args0)

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args1 : list term) (hd0 : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd0, args1) -> ∑ n : nat, ~~ isApp hd0 /\ l0 = skipn n args1 /\ f = mkApps hd0 (firstn n args1)
l, args0:list term
hd:term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
H0:(f, args ++ l) = (hd, args0)

∑ n : nat, ~~ isApp hd /\ l = skipn n args0 /\ tApp f args = mkApps hd (firstn n args0)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

∑ n : nat, ~~ isApp f /\ l = skipn n (args ++ l) /\ tApp f args = mkApps f (firstn n (args ++ l))
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

is_true (~~ isApp f)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
l = skipn #|args| (args ++ l) /\ tApp f args = mkApps f (firstn #|args| (args ++ l))
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

l = skipn #|args| (args ++ l) /\ tApp f args = mkApps f (firstn #|args| (args ++ l))
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

l = l /\ tApp f args = mkApps f (firstn #|args| (args ++ l))
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

l = l /\ tApp f args = mkApps f (firstn #|args| args ++ firstn (#|args| - #|args|) l)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

#|args| <= #|args|
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args
l = l /\ tApp f args = mkApps f (args ++ firstn (#|args| - #|args|) l)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

l = l /\ tApp f args = mkApps f (args ++ firstn (#|args| - #|args|) l)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

l = l /\ tApp f args = mkApps f args
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

tApp f args = mkApps f args
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
args:list term
Heq:isApp (tApp f args) = true
IHf:isApp f = true -> forall (l0 args0 : list term) (hd : term), Ast.wf f -> decompose_app (mkApps f l0) = (hd, args0) -> ∑ n : nat, ~~ isApp hd /\ l0 = skipn n args0 /\ f = mkApps hd (firstn n args0)
l:list term
isAppf:isApp f = false
Hargs:args <> []
wff:Ast.wf f
wfargs:Forall Ast.wf args

is_true (~~ is_empty args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false

Ast.wf f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
wff:Ast.wf f
fl:decompose_app (mkApps f l) = (hd, args)

∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
wff:Ast.wf f

is_true (~~ isApp f)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
wff:Ast.wf f
fl:(f, l) = (hd, args)
∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
wff:Ast.wf f
fl:(f, l) = (hd, args)

∑ n : nat, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args)
f:term
l:list term
hd:term
args:list term
Heq:isApp f = false
wff:Ast.wf f
fl:(f, l) = (hd, args)
H0:f = hd
H1:l = args

∑ n : nat, ~~ isApp hd /\ args = skipn n args /\ hd = mkApps hd (firstn n args)
hd:term
args:list term
fl:(hd, args) = (hd, args)
wff:Ast.wf hd
Heq:isApp hd = false

~~ isApp hd /\ args = skipn 0 args /\ hd = mkApps hd (firstn 0 args)
hd:term
args:list term
fl:(hd, args) = (hd, args)
wff:Ast.wf hd
Heq:isApp hd = false

is_true (~~ isApp hd)
now eapply negbT. Qed.
A:Type
x:A
n:nat
l:list A

[x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|
A:Type
x:A
n:nat
l:list A

[x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|
A:Type
x:A
n:nat

[x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn n (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ n = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|

[x] = skipn n (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ n = #|l'|
A:Type
x, a:A
l:list A
IHl:forall n : nat, [x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|

[x] = skipn 0 (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ 0 = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x, a:A
l:list A
IHl:forall n : nat, [x] = skipn n l -> exists l' : list A, l = l' ++ [x] /\ n = #|l'|

[x] = a :: l -> exists l' : list A, a :: l = l' ++ [x] /\ 0 = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x, a:A
IHl:forall n : nat, [x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|

[x] = [a] -> exists l' : list A, [a] = l' ++ [x] /\ 0 = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x, a:A
IHl:forall n : nat, [x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|
eq:[x] = [a]

exists l' : list A, [a] = l' ++ [x] /\ 0 = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x:A
IHl:forall n : nat, [x] = skipn n [] -> exists l' : list A, [] = l' ++ [x] /\ n = #|l'|

exists l' : list A, [x] = l' ++ [x] /\ 0 = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|

[x] = skipn (S n) (a :: l) -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|

[x] = skipn n l -> exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x:A
n:nat
a:A
l:list A
IHl:forall n0 : nat, [x] = skipn n0 l -> exists l' : list A, l = l' ++ [x] /\ n0 = #|l'|
Hx:[x] = skipn n l

exists l' : list A, a :: l = l' ++ [x] /\ S n = #|l'|
A:Type
x, a:A
l':list A
Hx:[x] = skipn #|l'| (l' ++ [x])
IHl:forall n : nat, [x] = skipn n (l' ++ [x]) -> exists l'0 : list A, l' ++ [x] = l'0 ++ [x] /\ n = #|l'0|

exists l'0 : list A, a :: l' ++ [x] = l'0 ++ [x] /\ S #|l'| = #|l'0|
exists (a :: l'); split; reflexivity. Qed.
f, u:term

Ast.wf f -> Ast.wf u -> strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term

Ast.wf f -> Ast.wf u -> strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u

Ast.wf (mkApp f u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
eq:mkApp f u = tApp f' args
isapp:is_true (~~ isApp f')

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
eq:decompose_app (mkApp f u) = decompose_app (tApp f' args)
isapp:is_true (~~ isApp f')

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
eq:decompose_app (mkApp f u) = (f', args)
isapp:is_true (~~ isApp f')

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
eq:decompose_app (mkApp f u) = (f', args)
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)

strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
eq:decompose_app (mkApp f u) = (f', args)
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)

mkApps (strip_casts f') (map strip_casts args) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)
eq:decompose_app (mkApps f [u]) = (f', args)

mkApps (strip_casts f') (map strip_casts args) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)
eq:decompose_app (mkApps f [u]) = (f', args)
n:nat
ng:is_true (~~ isApp f')
stripeq:[u] = skipn n args
stripf:f = mkApps f' (firstn n args)

mkApps (strip_casts f') (map strip_casts args) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)
eq:decompose_app (mkApps f [u]) = (f', args)
n:nat
ng:is_true (~~ isApp f')
stripeq:exists l' : list term, args = l' ++ [u] /\ n = #|l'|
stripf:f = mkApps f' (firstn n args)

mkApps (strip_casts f') (map strip_casts args) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
args:list term
isapp:is_true (~~ isApp f')
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts args)
eq:decompose_app (mkApps f [u]) = (f', args)
n:nat
ng:is_true (~~ isApp f')
l':list term
eqargs:args = l' ++ [u]
eqn:n = #|l'|
stripf:f = mkApps f' (firstn n args)

mkApps (strip_casts f') (map strip_casts args) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
isapp:is_true (~~ isApp f')
l':list term
eq:decompose_app (mkApps f [u]) = (f', l' ++ [u])
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts (l' ++ [u]))
ng:is_true (~~ isApp f')
stripf:f = mkApps f' (firstn #|l'| (l' ++ [u]))

mkApps (strip_casts f') (map strip_casts (l' ++ [u])) = mkApp (strip_casts f) (strip_casts u)
f, u:term
wf:Ast.wf f
wf':Ast.wf u
wfa:Ast.wf (mkApp f u)
f':term
isapp:is_true (~~ isApp f')
l':list term
eq:decompose_app (mkApps f [u]) = (f', l' ++ [u])
H:strip_casts (mkApp f u) = mkApps (strip_casts f') (map strip_casts (l' ++ [u]))
ng:is_true (~~ isApp f')
stripf:f = mkApps f' l'

mkApps (strip_casts f') (map strip_casts (l' ++ [u])) = mkApp (strip_casts f) (strip_casts u)
u, f':term
l':list term
H:strip_casts (mkApp (mkApps f' l') u) = mkApps (strip_casts f') (map strip_casts (l' ++ [u]))
eq:decompose_app (mkApps (mkApps f' l') [u]) = (f', l' ++ [u])
wf:Ast.wf (mkApps f' l')
wf':Ast.wf u
wfa:Ast.wf (mkApp (mkApps f' l') u)
isapp, ng:is_true (~~ isApp f')

mkApps (strip_casts f') (map strip_casts (l' ++ [u])) = mkApp (strip_casts (mkApps f' l')) (strip_casts u)
u, f':term
l':list term
H:strip_casts (mkApp (mkApps f' l') u) = mkApps (strip_casts f') (map strip_casts (l' ++ [u]))
eq:decompose_app (mkApps (mkApps f' l') [u]) = (f', l' ++ [u])
wf':Ast.wf u
wfa:Ast.wf (mkApp (mkApps f' l') u)
isapp, ng:is_true (~~ isApp f')
wff':Ast.wf f'
wfl:Forall Ast.wf l'

mkApps (strip_casts f') (map strip_casts (l' ++ [u])) = mkApp (strip_casts (mkApps f' l')) (strip_casts u)
u, f':term
l':list term
H:strip_casts (mkApp (mkApps f' l') u) = mkApps (strip_casts f') (map strip_casts (l' ++ [u]))
eq:decompose_app (mkApps (mkApps f' l') [u]) = (f', l' ++ [u])
wf':Ast.wf u
wfa:Ast.wf (mkApp (mkApps f' l') u)
isapp, ng:is_true (~~ isApp f')
wff':Ast.wf f'
wfl:Forall Ast.wf l'

mkApps (strip_casts f') (map strip_casts (l' ++ [u])) = mkApp (mkApps (strip_casts f') (map strip_casts l')) (strip_casts u)
now rewrite mkApp_mkApps mkApps_nested map_app. Qed.
f:term
u:list term

Ast.wf f -> Forall Ast.wf u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
u:list term

Ast.wf f -> Forall Ast.wf u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
u:list term
wf:Ast.wf f
wf':Forall Ast.wf u

strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u)
f:term
wf:Ast.wf f

strip_casts (mkApps f []) = mkApps (strip_casts f) (map strip_casts [])
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)
strip_casts (mkApps f (x :: l)) = mkApps (strip_casts f) (map strip_casts (x :: l))
f:term
wf:Ast.wf f

strip_casts f = strip_casts f
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)
strip_casts (mkApps f (x :: l)) = mkApps (strip_casts f) (map strip_casts (x :: l))
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)

strip_casts (mkApps f (x :: l)) = mkApps (strip_casts f) (map strip_casts (x :: l))
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)

Ast.wf (mkApp f x)
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)
mkApps (strip_casts (mkApp f x)) (map strip_casts l) = mkApps (strip_casts f) (map strip_casts (x :: l))
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)

mkApps (strip_casts (mkApp f x)) (map strip_casts l) = mkApps (strip_casts f) (map strip_casts (x :: l))
f:term
wf:Ast.wf f
x:term
l:list term
H:Ast.wf x
wf':Forall Ast.wf l
IHwf':forall f0 : term, Ast.wf f0 -> strip_casts (mkApps f0 l) = mkApps (strip_casts f0) (map strip_casts l)

mkApps (mkApp (strip_casts f) (strip_casts x)) (map strip_casts l) = mkApps (strip_casts f) (map strip_casts (x :: l))
now rewrite mkApps_mkApp. Qed.